Q
Problem solve Get help with specific problems with your technologies, process and projects.

Counting rows on distinct columns

  How do I code the SQL to count rows in a table on distinct columns (notice I didn't say column)? This works: SELECT COUNT(Distinct mynam) FROM TABLEABut, this does not: SELECT COUNT(Distinct mynam, birthdate) FROM TABLEAOff the top of my head, I have no clue how to do it in a compact manner. I'd send you to Advanced Transact-SQL For SQL Server 2000.For More InformationDozens more   answers to tough SQL Server questions from Michael Hotek are available here.  The Best Microsoft SQL Server Web Links: tips, tutorials, scripts, and more.  The Best SQL Web LinksHave a SQL Server tip to offer your fellow DBAs and developers? The best tips submitted will receive a cool prize.   Submit your tip today!Ask your technical SQL Server questions -- or help out your peers by answering them -- in our   live discussion forums.  Ask the Experts yourself: Our SQL, database design, SQL Server, DB2, object-oriented and data warehousing gurus are waiting to answer your toughest questions.

Dig Deeper on Microsoft SQL Server Installation

Have a question for an expert?

Please add a title for your question

Get answers from a TechTarget expert on whatever's puzzling you.

You will be able to add details on the next page.

Start the conversation

Send me notifications when other members comment.

Please create a username to comment.

-ADS BY GOOGLE

SearchBusinessAnalytics

SearchDataCenter

SearchDataManagement

SearchAWS

SearchOracle

SearchContentManagement

SearchWindowsServer

Close