select A =
         (select COUNT(*)from Activity where CrtUserID = 178864 and State = 0) *
         (select CKey1 from Category where CategoryID = 1004) +
         ((select COUNT(*) from ActivityCmt where CrtUserID = 178864 and State = 0) +  (select COUNT(*) from TopicCmt where CrtUserID = 178864 and State = 0) +(select COUNT(*) from PhotoCmt where CrtUserID = 178864 and State = 0)) *
         (select CKey1 from Category where CategoryID = 1006) +
         ((select COUNT(*) from ActivityPhotos where CrtUserID = 178864 and State = 0) + (select COUNT(*) from Photos where CrtUserID = 178864 and State = 0)) *
         (select CKey1 from Category where CategoryID = 1015) +
         (select COUNT(*) from Topic where CrtUserID = 178864 and State = 0) *
         (select CKey1 from Category where CategoryID = 1001) +
         (select COUNT(*)from Tweet  where CrtUserID = 178864 and State = 0) *
         (select CKey1 from Category where CategoryID = 1002)谢谢各位搭救了~~

解决方案 »

  1.   

    一堆没任何联系的表 怎么优化?sql是不能下手 只能从其他方面考虑了...
      

  2.   

    这~~什么意思?不懂~~sql优化说白了是算法针对当前业务逻辑和数据分布的一种固化算法
    离开了这些,剩下能做的就不多了,无非就是建建索引,建建分区表什么的
      

  3.   

    这个对where后面的字段做好索引就是优化