标题:如何把三个表中具有相同三个字段的数据查出来
只看楼主
关小彤
Rank: 1
等 级:新手上路
帖 子:114
专家分:0
注 册:2006-12-7
 问题点数:0 回复次数:1 
如何把三个表中具有相同三个字段的数据查出来
select sname,sfzh,leibie from
(select sname,sfzh,leibie from no2004 where result='未通过'
union all
select sname,sfzh,leibie from no2005 where result='未通过'
union all
select sname,sfzh,leibie from no2006 where result='未通过'
) a group by sfzh,leibie having count(1)>=2
我从040506三年中找出连续考两次不过的人的名单后.如何在从040506三年的总表中找到这些数据?

数据结构如下:
sname,
sfzh,
leibie,
tel,
company.
谢谢
搜索更多相关主题的帖子: 字段 数据 
2007-01-13 15:42
棉花糖ONE
Rank: 7Rank: 7Rank: 7
等 级:贵宾
威 望:32
帖 子:2987
专家分:0
注 册:2006-7-13
得分:0 
select sname,sfzh,leibie from no2004 where result='未通过'
union all
select sname,sfzh,leibie from no2005 where result='未通过'
union all
select sname,sfzh,leibie from no2006 where result='未通过'
这个就是包含三年中所有不过的人的资料

26403021 sql群 博客 blog./user15/81152/index.shtml
2007-01-13 15:59



参与讨论请移步原网站贴子:https://bbs.bccn.net/thread-115779-1-1.html




关于我们 | 广告合作 | 编程中国 | 清除Cookies | TOP | 手机版

编程中国 版权所有,并保留所有权利。
Powered by Discuz, Processed in 1.142562 second(s), 7 queries.
Copyright©2004-2025, BCCN.NET, All Rights Reserved