(补充)在2005.net中如何将从数据库多表联合查询出的数据写回到另一个表中

 
5 张表:(项目表) item_table(salaryid,salaryitem,salarynumber,itemid);
( 人员考核表 )kaohe_table(kaoheid,id,salaryid,nowtime);
( 人员表 )name_table (id,name);
( 考核类型 )type_table (itemid,items,itemnumber)
( 联合查询要写回数据的表 )display_table (displayid,name,safty,service,clear,quality,method,countmoney,nowtiem)
 
查询语名:        string sql = "SELECT b.name, SUM(CASE c.itemid WHEN '1' THEN c.salarynumber ELSE 0 END) AS a,                                                                                                                                                                                        SUM(CASE c.itemid WHEN '2' THEN c.salarynumber ELSE 0 END) AS b,                                                                  SUM(CASE c.itemid WHEN '3' THEN c.salarynumber ELSE 0 END) AS c,                                                                   SUM(CASE c.itemid WHEN '4' THEN c.salarynumber ELSE 0 END) AS d,                                                              SUM(CASE c.itemid WHEN '5' THEN c.salarynumber ELSE 0 END) AS e,                               a.nowtime                                                                                                                                                                            FROM kaohe_table AS a INNER JOIN name_table AS b ON a.id = b.id INNER JOIN Item_table AS c ON a.salaryid = c.salaryid INNER JOIN Type_table AS d ON c.itemid = d.itemid                                                          WHERE (a.nowtime = '"+要查询时间+"')                                                                                                                    GROUP BY b.name, a.nowtime";
                 以上联系合查询出的a,b,c,d,e,nowtime各个列的数据写回到display_table表相应的字段中去.                                 a---对应字段-------safty            b----对应字段------service                                                                   c----对应字段-------clear                                        d-----对应字段----quality  
查询出的结果,我不知道如何写回到display_table表中去,请高手帮忙.谢谢.
 
 
评论 2
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值