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

from a,b left join ...
select * from a,b left join c on c.id=b.id where b.kid=a.kid

from 两个表, 再加上一个 left jion ,提示不支持join表达式~

这种写法应该怎么写呢?

求救!!


------解决方案--------------------
SQL code
select * from a 
inner join b  on  b.kid=a.kid
left join c on c.id=b.id

------解决方案--------------------
...

SQL code
select *
from (
 select * from a,b 
 where b.kid=3 
) a left join c on c.id=a.id

------解决方案--------------------
如果a、b表有重复列,将*替换为不重复的列。
------解决方案--------------------
a,b两表是什么关系?
------解决方案--------------------
C# code

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

------解决方案--------------------
SQL code
--方法一:
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

------解决方案--------------------
学习!
------解决方案--------------------
探讨
SQL code
--方法一:
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

------解决方案--------------------
SQL code

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
------解决方案--------------------
探讨
...


SQL code
select *
from (
select * from a,b
where b.kid=3
) a left join c on c.id=a.id

------解决方案--------------------
好乱。。a,b俩表是咋个连接的哦。。我到觉得8楼的可以。
------解决方案--------------------
在帮助那里有标准语句滴,我也是经常看那里才懂
------解决方案--------------------
在sql2000的northwind数据库,试了一下LZ格式的查询,并无不妥,估计是LZ查询中连接的列写错

SQL code
select * from orders a,[order details] b left join products c on b.productid=c.productid
where a.orderid=b.orderid

------解决方案--------------------
SQL92和T-SQL可以同时使用,但是不能混合使用。在一个查询或者子查询里,只能用一种吧,我是这么觉得。