请兄弟帮我看看这个SQL怎么写,写了好久没试出来
表table 1
DATE
2007-01-01
2007-01-02
.........
2007-01-30
表table2
empId date
jc001 2007-01-01
jc001 2007-01-02
jc001 2007-01-03
jc001 2007-01-08
jc001 2007-01-20
jc002 2007-01-01
jc002 2007-01-02
jc002 2007-01-02
jc003 2007-01-15
jc002 2007-01-30
....................
我想的结果是连个表进行连接查询
得到
DATE ID
2007-01-01 JC001
......... NULL
2007-01-30 JC001
2007-01-01 JC002
.................
2007-01-30 JC002
就是要一各整月数据,但T2中不是整月的就是NULL
T1 是各 日期表丛2007-01-01 --2007-01-30
请问这个SQL 怎么写
------解决方案--------------------select table1.[DATE],table2[id]
from table1
left join table2
on table1.[DATE]=table2.[DATE]
------解决方案--------------------来晚了