Re: slecting multiple distinct columns..
- From: jennifer1970@xxxxxxxxxxx
- Date: 7 Mar 2006 11:42:19 -0800
Try the Having clause
For example, this will bring back records that have duplicate records
for Col1, Col2 and Col3.
If you want only records that have a single record, you can change ">
1" to "= 1".
SELECT DISTINCT
Col1, Col2, Col3, COUNT(*) as NumberDups
FROM SomeTable
GROUP BY Col1, Col2, Col3
HAVING COUNT(*) > 1
Of course, you could post your table definitions with Create statements
and insert statements so people could have data to work with to help
you.
vvyshak@xxxxxxxxx wrote:
Hi all...
I have a table in which some columns has distinct values and some has
duplicates..i wan to select all the columns with distinct values....no
problem if rows has null value in it....i tried a lot wit distinct and
group by but nothing got worked out...
Waitin for your reply.....
Thanking you...
.
- References:
- slecting multiple distinct columns..
- From: vvyshak
- slecting multiple distinct columns..
- Prev by Date: Re: ORDER BY in VIEW not working
- Next by Date: Can a stored procedure parameter be optional
- Previous by thread: slecting multiple distinct columns..
- Next by thread: Re: slecting multiple distinct columns..
- Index(es):
Relevant Pages
|