编程论坛's Archiver

cyyu_ryh 发表于 2008-2-4 17:12

求助:查询错误

select Users.UserID as UserID,Users.CustomerName,Users.CustomerAddress,Users.CustomerTelephone,Users.ZipCode,Flower.[ID],Shopping.[ID],Shopping.UserID as SuserID from Users left join  Shopping on Users.UserID=Shopping.UserID left join Flower on Shopping.[ID]=Flower.[ID]
我在ACCECE查询分析器里面始终是这个错误

[color=Red]语法错误 (操作符丢失) 在查询表达式 'Users.UserID=Shopping.UserID                            left join Flower on Shopping.[ID]=Flower.[ID]' 中。[/color]

但是在SQL2000中不报错
请问为什么?我需要用ACCECE语句

madpbpl 发表于 2008-2-4 21:11

select Users.UserID as UserID,Users.CustomerName,Users.CustomerAddress,Users.CustomerTelephone,Users.ZipCode,Flower.[ID],Shopping.[ID],Shopping.UserID as SuserID from Users,Flower left join  Shopping on Users.UserID=Shopping.UserID where Shopping.[ID]=Flower.[ID]
改成这样试试,两个left join好象不能这样写的。

cyyu_ryh 发表于 2008-2-14 15:46

也不行啊
提示:
JOIN 操作语法错误。

cyyu_ryh 发表于 2008-2-14 16:07

可以了,在前加个括号就可以了
select Users.UserID as UserID,Users.CustomerName,Users.CustomerAddress,Users.CustomerTelephone,Users.ZipCode,Flower.[ID],Shopping.[ID],Shopping.UserID as SuserID from (Users left join  Shopping on Users.UserID=Shopping.UserID) left join Flower on Shopping.[ID]=Flower.[ID]

页: [1]

Powered by Discuz! Archiver 6.1.0  © 2001-2007 Comsenz Inc.