如何在sql server中从表中查找公共行 [英] how to find common rows from table in sql server

查看:76
本文介绍了如何在sql server中从表中查找公共行的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在开发一个数据库(电子商务网站)。在那一个有重复记录的表中。我希望你的帮助在SQL Server的50列表中找到重复记录。



有''_id''列有表中的主键但是我必须避免它来查找重复记录。

解决方案

选择col_name,计数(col_name)从tbl_name group by col_name having count(col_name)> ; 1

I am working on one database(ecommerce site). in that one table with duplicate records.I want your help to find duplicate records in a 50 column table on SQL Server.

There are ''_id'' column have primary key in table but i have to avoid it for find duplicate records .

解决方案

select col_name,count(col_name) from tbl_name group by col_name having count(col_name) > 1


这篇关于如何在sql server中从表中查找公共行的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆