|
database
newsgroups
|
|||||||||||||||||||||||
|
|||||||||||||||||||||||
extract non-unique records from a tableCan anyone pls help me with any SQL syntax / logic of extracting only the
non-unique records from an SQL table ? Thanks Shekhar If i understand correctly you're after a query that returns the duplicates.
If so give this a try :- SELECT Col001, COUNT(*) FROM tablename GROUP BY Col001 HAVING COUNT(*) > 1 This will return any Col001 that are duplicate -- Show quoteHTH. Ryan "Shekhar Gupta" <ShekharGu***@discussions.microsoft.com> wrote in message news:38DC7E2D-051B-4573-9C9A-5B6164F99E78@microsoft.com... > Can anyone pls help me with any SQL syntax / logic of extracting only the > non-unique records from an SQL table ? > > Thanks > Shekhar gr8, Thanks Ryan, this worked
shekhar Show quote "Ryan" wrote: > If i understand correctly you're after a query that returns the duplicates. > If so give this a try :- > > SELECT Col001, COUNT(*) FROM tablename > GROUP BY Col001 > HAVING COUNT(*) > 1 > > This will return any Col001 that are duplicate > > -- > HTH. Ryan > > > "Shekhar Gupta" <ShekharGu***@discussions.microsoft.com> wrote in message > news:38DC7E2D-051B-4573-9C9A-5B6164F99E78@microsoft.com... > > Can anyone pls help me with any SQL syntax / logic of extracting only the > > non-unique records from an SQL table ? > > > > Thanks > > Shekhar > > > |
|||||||||||||||||||||||