select SUM(dr_amount)-SUM(cr_amount)" +
"from Gl_Transaction where Accountno like'1%' select SUM(dr_amount)-SUM(cr_amount)" +
"from Gl_Transaction where Accountno like'2%'" +
"select SUM(dr_amount)-SUM(cr_amount)" +
"from Gl_Transaction where Accountno like'3%'" +
"select SUM(dr_amount)-SUM(cr_amount)" +
"from Gl_Transaction where Accountno like'4%'" +
"select SUM(dr_amount)-SUM(cr_amount)" +
"from Gl_Transaction where Accountno like'5%'";
SQL不"..."+
用于连接行...删除它们。
而且,如果AccountNo是整数,则必须隐藏字符串才能使用LIKE。
select SUM(dr_amount)-SUM(cr_amount)
from Gl_Transaction where convert(varchar(max),Accountno) like'1%'
select SUM(dr_amount)-SUM(cr_amount)
from Gl_Transaction where convert(varchar(max),Accountno) like'2%'
select SUM(dr_amount)-SUM(cr_amount)
from Gl_Transaction where convert(varchar(max),Accountno) like'3%'
select SUM(dr_amount)-SUM(cr_amount)
from Gl_Transaction where convert(varchar(max),Accountno) like'4%'
select SUM(dr_amount)-SUM(cr_amount)
from Gl_Transaction where convert(varchar(max),Accountno) like'5%'
本文收集自互联网,转载请注明来源。
如有侵权,请联系[email protected] 删除。
我来说两句