Please start any new threads on our new site at https://forums.sqlteam.com. We've got lots of great SQL Server experts to answer whatever question you can come up with.

 All Forums
 General SQL Server Forums
 New to SQL Server Programming
 SELECT the repeated-same rows

Author  Topic 

muhamet.fetaj
Starting Member

1 Post

Posted - 2008-02-05 : 04:59:10
Hi!

I am beginner on using SQL.
How can I select the repeated rows (five or more times) on a table which have the same ID's but different updated date. I do not need to group all the rows with the same ID,s but rows which are repeated many times according to the required reports needed.

Below are some information regarding tables and views:

VIEW name= dbo.tblCCInvoicesH
COLUMN ID= ConsumerID
COLUMN DATE= ReadingDate

Thank you in advance...

meti

SwePeso
Patron Saint of Lost Yaks

30421 Posts

Posted - 2008-02-05 : 05:03:11
SELECT ConsumerID
FROM dbo.tblCCInvoicesH
GROUP BY ConsumerID
HAVING COUNT(DISTINCT ReadingDate) >= 5



E 12°55'05.25"
N 56°04'39.16"
Go to Top of Page
   

- Advertisement -