求sql语句

有表1如下:
ID NAME
1 A
2 B
3 C
表2如下:
ID USER
1 01
1 02
1 01
2 02 
2 03
3 02
我想得到以下的结果:
ID NAME USER
1 A 01
1 A 02
2 B 02
2 B 03
3 C 02
应该怎么写这个语句呢???

作者: yuxi5622   发布时间: 2011-06-16

SQL code
select distinct a.id,a.name,b.user
from 表1 a,表2 b where a.id=b.id

作者: zy112429   发布时间: 2011-06-16

SQL code
select a.id,a.name,t.user from
(
select distinct * from b
) as t join a on t.id = a.id

作者: aspwebchh   发布时间: 2011-06-16

SQL code
select distinct tb1.id , tb1.name ,tb2.users
from tb1 left join tb2
on tb1.id =tb2.id

作者: chuanzhang5687   发布时间: 2011-06-16