S small_tail Unregistered / Unconfirmed GUEST, unregistred user! 2009-03-09 #1 我有个表,字段是t1,t2.......tn,我怎么能把它们求和,非select sum(t1+t2+t3.....+tn) from table,有什么类是sum(t1:tn)的语句么?
Z znxia Unregistered / Unconfirmed GUEST, unregistred user! 2009-03-09 #3 没有,但你可以提前先做一个视图,将这些字段相累加,然后对这个视图进行SUM.
Z znxia Unregistered / Unconfirmed GUEST, unregistred user! 2009-03-09 #5 Create view V_Table1 as Select isNull(t1,0)+isNull(t2,0)+isNull(t3,0)+isNull(t4,0)+isNull(t5,0) as T1_N from Table1---------Select Sum(t1_n) from v_table1
Create view V_Table1 as Select isNull(t1,0)+isNull(t2,0)+isNull(t3,0)+isNull(t4,0)+isNull(t5,0) as T1_N from Table1---------Select Sum(t1_n) from v_table1