日期:2014-05-17 浏览次数:20803 次
--这两个表是通过add_time和create_time进行关联吗? select mat_name,prod_shift_group,substr(add_time, 7, 2), sum(mat_wt) from table01,table02 where table01.add_time=table02.create_tiem add_time > '20110301005010' and add_time < '20110303060930' group by mat_name,prod_shift_group,substr(add_time, 7, 2)
------解决方案--------------------
select mat_name,prod_shift_group,substr(add_time, 7, 2), sum(mat_wt) from table01,table02 where table01.add_time=table02.create_tiem add_time > '20110301005010' and add_time < '20110303060930' group by mat_name,prod_shift_group,substr(add_time, 7, 2)
------解决方案--------------------
select mat_name,prod_shift_group,to_char(add_time,'yyyymmdd'), sum(mat_wt) from table01,table02 where table01.add_time=table02.create_tiem add_time > '20110301005010' and add_time < '20110303060930' group by mat_name,prod_shift_group,to_char(add_time,'yyyymmdd')