日期:2014-05-17 浏览次数:20477 次
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 ,
MAX(c.wxxm_mc) wxxm_mc
FROM 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 datediff(month,[card_jlrq],getdate())=0 and a.gongsiNo = '02'
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