22,209
社区成员
发帖
与我相关
我的任务
分享
SELECT a.card_no ,a.Card_jlrq ,a.card_kehu_mc ,a.card_kehu_shouji,a.gongsiNo ,a.gongsiMc ,MAX(b.work_no) work_no ,b.xche_ssje ,min(c.wxxm_mc) wxxm_mc FROM qpqxbs001.dbo.Card a LEFT JOIN work_pz_sj b ON a.card_no = b.card_no LEFT JOIN work_mx_sj c ON b.work_no = c.work_no WHERE a.gongsiNo='02' and a.Card_jlrq >='2014-02-01' and a.Card_jlrq <='2014-02-20' GROUP BY a.card_no ,a.Card_jlrq , a.card_kehu_mc ,a.card_kehu_shouji ,a.gongsiNo ,a.gongsiMc ,b.xche_ssje ORDER BY card_jlrq DESC