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

数据库多表查询的有关问题

2012-04-27 
数据库多表查询的问题我有A、B、C、D、E、F、G这几个表 每个表里面有user这个列 我想在他们之间查询user小明

数据库多表查询的问题
我有A、B、C、D、E、F、G这几个表 每个表里面有user这个列 我想在他们之间查询user='小明'这个结果的所有集合,该怎么写SQL语句。

[解决办法]

SQL code
select user,name from a where user='小明'union allselect  user,name  from b where user='小明'union allselect  user,name from c where user='小明'union allselect  user,name  from d where user='小明'union allselect  user,name  from e where user='小明' 

热点排行