日期:2014-05-17 浏览次数:20478 次
select * from (select w.che_no,h.kehu_no,w.kehu_mc,w.kehu_xm,k.kehu_tianjiagongsi,k.kehu_dh,h.jiesuan_rq,h.huifang_rq,w.kehu_dz,w.Xche_wxfl,w.che_cx,w.GongSiNo,w.kehu_dp,w.xche_jb,w.work_no from work_huifang_tix h inner join work_pz_sj w on h.work_no=w.work_no inner join kehu k on k.kehu_no=h.kehu_no where h.huifang_xz=0 )a left join (select work_huif_rq,kehu_no as che_number from work_huifang where id in (select max(id) from work_huifang group by kehu_no))b on a.kehu_no = b.che_number where 1=1 and ( 1<0 or GongSiNo='01' or GongSiNo='02') and huifang_rq>= '2014-1-7' and huifang_rq <'2014-1-15'
select *
from (
select w.che_no,h.kehu_no,w.kehu_mc,w.kehu_xm,k.kehu_tianjiagongsi,k.kehu_dh,h.jiesuan_rq,h.huifang_rq,w.kehu_dz,w.Xche_wxfl,w.che_cx,w.GongSiNo,w.kehu_dp,w.xche_jb,w.work_no
from work_huifang_tix h
inner join work_pz_sj w on h.work_no=w.work_no
inner join kehu k on k.kehu_no=h.kehu_no
where h.huifang_xz=0
)a
left join
(
select work_huif_rq,kehu_no as che_number
from work_huifang a
inner join
(
select max(id) id
from work_huifang
group by kehu_no
)b
on a.id = b.id
)b on a.kehu_no = b.che_number
where 1=1 and ( 1<0 or GongSiNo='01' or GongSiNo='02')
and huifang_rq>= '2014-1-7' and huifang_rq <'2014-1-15'