胡 胡鸣 Unregistered / Unconfirmed GUEST, unregistred user! 2010-06-17 #1 现有一个表结构及数据如下:field1 field21001 1001111 2001001 3001111 400现在想求field1等于1001的合计与等于1111的合计的差额,请问sql语句的写法。
现有一个表结构及数据如下:field1 field21001 1001111 2001001 3001111 400现在想求field1等于1001的合计与等于1111的合计的差额,请问sql语句的写法。
S szhcracker Unregistered / Unconfirmed GUEST, unregistred user! 2010-06-17 #2 Oracle的语句你试试:Select r1001.V1 - r1111.V1 Rst From (Select Sum(f2) V1 From tmpa Where f1 = 1001) r1001, (Select Sum(f2) V1 From tmpa Where f1 = 1111) r1111
Oracle的语句你试试:Select r1001.V1 - r1111.V1 Rst From (Select Sum(f2) V1 From tmpa Where f1 = 1001) r1001, (Select Sum(f2) V1 From tmpa Where f1 = 1111) r1111
S szhcracker Unregistered / Unconfirmed GUEST, unregistred user! 2010-06-17 #3 or:Select (Select Sum(f2) V1 From tmpa Where f1 = 1001) - (Select Sum(f2) V1 From tmpa Where f1 = 1111) Rst From dual
or:Select (Select Sum(f2) V1 From tmpa Where f1 = 1001) - (Select Sum(f2) V1 From tmpa Where f1 = 1111) Rst From dual