select * from (select * from a union all select * from b) T where name in (select name from a where name in( select name from b))
已经经过测试。
你是要查找数据库中某个字段下的相同数据吧,我给你写2个例子(数据库执行效率高)
select * from dbo.MediafileInfo as a where
(VideoDownUrl IN (SELECT VideoDownUrl FROM MediafileInfo AS B WHERE A.ProgramID <>B.ProgramID))
(数据库执行效率低)
SELECT *
FROM MediafileInfo AS A
WHERE (SELECT COUNT(*) FROM MediafileInfo WHERE VideoDownUrl=A.VideoDownUrl)>1
欢迎分享,转载请注明来源:内存溢出
评论列表(0条)