读书人

求多表查询语句解决方法

发布时间: 2012-02-19 19:43:39 作者: rapoo

求多表查询语句
表user:
id: 1
name:a
表x:
id: 1 2
user_id: 1 1
x: 56 23

如何查询:name,x呢?

select name,x
from user,x
where user.id=user_id and user.id=1
是否正确?

[解决办法]
select name,x
from user,x
where user.id=x.user_id and user.id=1
少了x.

读书人网 >SQL Server

热点推荐