当前位置: 代码迷 >> Sql Server >> 求多表查询语句解决方法
  详细解决方案

求多表查询语句解决方法

热度:154   发布时间:2016-04-27 19:40:02.0
求多表查询语句
表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.
  相关解决方案