"select * from ( select (select code from kklw.checkpoint_code where code=kkbh and type='2') code,"+
"(select display from kklw.checkpoint_code where code=t1.kkbh ) diaplay, "+
"sum(t1.jsl)+sum(t1.csl) ,sum(t1.jsl) ,sum(t1.csl) ,sum(t1.sbsl),sum(t1.wsbsl) "+
" from kklw.vehicle_flow_statis_hour t1 where t1.sj>='"+weekstart0+"' and t1.sj<='"+weekend0+"'"+
"group by t1.kkbh) t where t.code is not null";
t和t1是什么,为什么要用他们
"(select display from kklw.checkpoint_code where code=t1.kkbh ) diaplay, "+
"sum(t1.jsl)+sum(t1.csl) ,sum(t1.jsl) ,sum(t1.csl) ,sum(t1.sbsl),sum(t1.wsbsl) "+
" from kklw.vehicle_flow_statis_hour t1 where t1.sj>='"+weekstart0+"' and t1.sj<='"+weekend0+"'"+
"group by t1.kkbh) t where t.code is not null";
t和t1是什么,为什么要用他们
也可以不用,如果你不闲麻烦写表的名字
为什么括号外面有code,display
"(select display from kklw.checkpoint_code where code=t1.kkbh ) diaplay, "+
"sum(t1.jsl)+sum(t1.csl) ,sum(t1.jsl) ,sum(t1.csl) ,sum(t1.sbsl),sum(t1.wsbsl) "+
" from kklw.vehicle_flow_statis_hour t1 where t1.sj >= ""+weekstart0+" " and t1.sj <= ""+weekend0+" ""+
"group by t1.kkbh) t where t.code is not null";
code,diaplay是对应所作选取列的别名,
为了书写和阅读直观,明了!