首页 诗词 字典 板报 句子 名言 友答 励志 学校 网站地图
当前位置: 首页 > 教程频道 > 数据库 > SQL Server >

left join有关问题

2012-01-18 
left join问题tbl1type1type2modelid1id2model1tbl2type1type2valuecreatedateid1id2value12007-1-1id1id2

left join问题
tbl1
type1     type2         model
id1         id2           model1

tbl2
type1       type2       value   createdate
id1           id2           value1   2007-1-1
id1           id2           value2   2007-1-2

我想得到
model     type1   type2     value
model1     id1       id2       value2
left   join
我直接写的
select   *   from   tbl1  
left   join   tbl2   on   tbl1.type1=tbl2.type1   and   tbl1.type1=tbl2.type2
where   model=model1

重复记录了


[解决办法]
为什么value取value2而不是value1?
[解决办法]
weasea(尘一笑)~我用的子查询~~~
为什么一定要用left join~~~快吗???还是你想知道left join实现

热点排行