December 4, 2008 at 6:44 am
I have a table that I want to count the number of distinct rows in but I need base it off of two columns that make up the primary key.
select distinct ReqID, ClientId from employees.
How do I count the number of rows from the above query?
December 4, 2008 at 6:47 am
This may not be the most efficient way:
SELECT COUNT(*)
FROM (SELECT DISTINCT ReqID, ClientID FROM employees) E
December 4, 2008 at 6:51 am
Awesome. I had forgotten to alias the select clause.
December 5, 2008 at 5:09 am
Maybe?
SELECT count(DISTINCT str(ReqID) + str(ClientID)) FROM employees
Viewing 4 posts - 1 through 4 (of 4 total)
You must be logged in to reply to this topic. Login to reply
This website stores cookies on your computer.
These cookies are used to improve your website experience and provide more personalized services to you, both on this website and through other media.
To find out more about the cookies we use, see our Privacy Policy