如何查询mysql数据库中部分重复的数据
例如,某字段下的数据是123456789和020123456789,后面9位是相同的,就算做是重复数据,同理987654321和020987654321,也因为是后面9位...
例如,某字段下的数据是123456789和020123456789,后面9位是相同的,就算做是重复数据,同理987654321和020987654321,也因为是后面9位相同,也可以筛选出来。
展开
1个回答
展开全部
你是要查找数据库中某个字段下的相同数据吧,我给你写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
(数据库执行效率高)
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
推荐律师服务:
若未解决您的问题,请您详细描述您的问题,通过百度律临进行免费专业咨询