You are here: Re: slecting multiple distinct columns.. « MsSQL Server « IT news, forums, messages
Re: slecting multiple distinct columns..

Posted by jennifer1970 on 03/07/06 21:42

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@gmail.com 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...

 

Navigation:

[Reply to this message]


Удаленная работа для программистов  •  Как заработать на Google AdSense  •  England, UK  •  статьи на английском  •  PHP MySQL CMS Apache Oscommerce  •  Online Business Knowledge Base  •  DVD MP3 AVI MP4 players codecs conversion help
Home  •  Search  •  Site Map  •  Set as Homepage  •  Add to Favourites

Copyright © 2005-2006 Powered by Custom PHP Programming

Сайт изготовлен в Студии Валентина Петручека
изготовление и поддержка веб-сайтов, разработка программного обеспечения, поисковая оптимизация