如何检查2行在sql的表中是否具有相同的数据? [英] how to check if 2 rows have same data in a table in sql?
本文介绍了如何检查2行在sql的表中是否具有相同的数据?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
我有以下查询..现在我必须检查相同的列是否具有相同的数据..
谁能帮助我查询pls
I have the following query..now i have to check if the same columns have same data..
Can anyone help me with the query pls
SELECT FirstName,MiddleName,LastName,Company,TaxExempt,AddressTitle,AddressLine1,AddressLine2,City,[State],ZipCode,Country,PhoneNumber,EmailID,o.OrderNumber,o.PONumber FROM CustomerAddresses ca join Orders o on ca.CustomerID=o.CustomerID where AddressTitle='Billing'
推荐答案
点击链接可能会对您有所帮助..
http://blog.sqlauthority.com/2007/07/11 /sql-server-count-duplicate-records-rows/ [
Follow the link it might help to you..
http://blog.sqlauthority.com/2007/07/11/sql-server-count-duplicate-records-rows/[^]
SELECT FirstName,MiddleName,LastName,Company,TaxExempt,AddressTitle,AddressLine1,AddressLine2,City,[State],ZipCode,Country,PhoneNumber,EmailID,
o.OrderNumber,o.PONumber FROM CustomerAddresses ca join Orders o on ca.CustomerID=o.CustomerID ,Count(*)As Count where AddressTitle='Billing'
Group by FirstName,MiddleName,LastName,Company,TaxExempt,AddressTitle,AddressLine1,AddressLine2,City,[State],ZipCode,Country,PhoneNumber,EmailID,
o.OrderNumber,o.PONumber FROM CustomerAddresses ca join Orders o on ca.CustomerID=o.CustomerID Having Count(*)>1
这篇关于如何检查2行在sql的表中是否具有相同的数据?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文