Intersect是在Analysis Services里面用的,不好意思我没有学过Oracle,所以可能没有理解你的意思据一个小例子:create table t1 (i int)
create table t2 (j int)insert t1 values (1)
insert t1 values (3)
insert t1 values (4)insert t2 values (1)
insert t2 values (5)
insert t2 values (7)
insert t2 values (3)select * from t1 where t1.i IN (select * from t2)
create table t2 (j int)insert t1 values (1)
insert t1 values (3)
insert t1 values (4)insert t2 values (1)
insert t2 values (5)
insert t2 values (7)
insert t2 values (3)select * from t1 where t1.i IN (select * from t2)
解决方案 »
- 急!急!菜鸟求助....2条SQL语句
- 关系约束能不能临时关闭和打开?
- 字符長度問題,簡單的
- 求一句更新的SQL语句,高手请来~~
- vb执行sql alter database 出错 求高手
- 大家来帮个忙!!在线等!!急啊!!!
- 有人在用邹建的分页的TOP n 实现的通用分页存储过吗
- 关于分页!小计,页数的获取问题?我现在一点思路都没有
- 我的sqlserver启动不了,我搜索了以前的记录,找不到原因
- sql server 7.0 问题
- EXCEL数据导入SQLSERVER数据库问题!
- 谁能解决这个sql server2000企业版在Window Advanced server2000中的安装问题,马上给200分!
SELECT U.字段列表 FROM
(SELECT DISTINCT TABLE1.字段列表
UNION ALL
SELECT DISTINCT TABLE2.字段列表
)
GROUP BY U.字段列表
HAVING COUNT(*)>1
--两表要有兼容性啊
--你可以看看下面的意思:
SELECT U.字段列表 FROM
(SELECT DISTINCT TABLE1.字段列表
UNION ALL
SELECT DISTINCT TABLE2.字段列表
) U
GROUP BY U.字段列表
HAVING COUNT(*)>1
--两表要有兼容性啊
select * from (
select 1994 as ye union all
select 1995 union all
select 1996
) a where exists
(
select 1 from
(
select 1995 as ye union all
select 1996 union all
select 1997
) b where a.ye=b.ye
)