日期:2014-05-18 浏览次数:20670 次
select * from a inner join b on b.kid=a.kid left join c on c.id=b.id
------解决方案--------------------
...
select * from ( select * from a,b where b.kid=3 ) a left join c on c.id=a.id
------解决方案--------------------
如果a、b表有重复列,将*替换为不重复的列。
------解决方案--------------------
a,b两表是什么关系?
------解决方案--------------------
select * from a left join b on b.kid=a.kid left join c on c.id=b.id
------解决方案--------------------
select * from a
inner join b on b.kid=a.kid
left join c on c.id=b.id
------解决方案--------------------
select * from a,b left join c on c.id=b.id where b.kid=3
,表示默认的inner join ,只匹配两表相同的值。
一个,又有left join显的不伦不类。后面加个括号 as ,或者改成inner join
select * from a,(select * from b left join c on c.id=b.id where b.kid=3) as D
------解决方案--------------------
--方法一: select * from a,b,c where a.id=b.id and c.id=b.id ---方法二: select * from a inner join b on a.id=b.id left join c on c.id=b.id
------解决方案--------------------
学习!
------解决方案--------------------
select * from a,b left join c on c.id=b.id where b.kid=a.kid =》 select * from a join b on b.kid=a.kid left join c on c.id=b.id
------解决方案--------------------
select *
from (
select * from a,b
where b.kid=3
) a left join c on c.id=a.id 正解!
------解决方案--------------------
select * from a
inner join b on b.kid=a.kid
left join c on c.id=b.id
------解决方案--------------------
select * from orders a,[order details] b left join products c on b.productid=c.productid where a.orderid=b.orderid
------解决方案--------------------
SQL92和T-SQL可以同时使用,但是不能混合使用。在一个查询或者子查询里,只能用一种吧,我是这么觉得。