日期:2014-05-18  浏览次数:20591 次

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实现