首页 诗词 字典 板报 句子 名言 友答 励志 学校 网站地图
当前位置: 首页 > 教程频道 > 数据库 > SQL Server >

求多表查询语句解决方法

2012-02-19 
求多表查询语句表user:id:1name:a表x:id:12user_id:11x:5623如何查询:name,x呢?selectname,xfromuser,xwhe

求多表查询语句
表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.

热点排行