菜鸟问语法(不够再给)
表A
bdepart char(12)
salary1 float
salary2 float
salary3 float
salary4 float
salary5 float
salary6 float
salary7 float
salary8 float
salary9 float
erji char(1)
bdepartpid char(4)
现在想把数据根据条件汇总到一张汇总表B里作统计然后绑定到GridView
表B
bdepart char(12)
tongji1 float 条件1
tongji2 float 条件2
....
其中数据汇方法如下:
先select distinct bdepart from A where erji= 't ' order by bdepartpid
for i=0 to bdepart的记录数
select sum(salary1) from A where bdepart=@bdepart
插sum(salary1)到表B的tongji[i]中
next
请问这样的后台语法如何写呀?(顺便问一下,是像我这样写好还是先放到dataset再插到数据库?)
------解决方案--------------------不会,帮楼主顶顶
------解决方案--------------------先读出再插入另一表是吗
------解决方案--------------------select max(decode(id,1,name)) f1,max(decode(id,2,name))f2,max(decode(id,3,name))f3,max(decode(id,4,name))f4
from t_test
union all
select to_char(max(decode(id,1,id))) f1,to_char(max(decode(id,2,id)))f2,to_char(max(decode(id,3,id)))f3,to_char(max(decode(id,4,id)))f4
from t_test
我也没试过,是在别的地方找的,你可以试试