This won't work...
SELECT count(distinct z.id, c.alias, c.type)
FROM customer c JOIN zsource z ON c.id=z.id
How can I count the number of distinct combinations of 3 separate fields?This should work :
SELECT count(*) FROM (
SELECT distinct z.id, c.alias, c.type
FROM customer c JOIN zsource z ON c.id=z.id) a
-Nags
"Dave" <dave@.nodomain.tv> wrote in message
news:#H8rx9bFEHA.2576@.TK2MSFTNGP11.phx.gbl...
> This won't work...
> SELECT count(distinct z.id, c.alias, c.type)
> FROM customer c JOIN zsource z ON c.id=z.id
> How can I count the number of distinct combinations of 3 separate fields?
>|||This is one way. There could be other better ways.
select count(RecCount)
from (select count(*) as RecCount
from customer c JOIN zsource z ON c.id=z.id
group by z.id, c.alias, c.type) d
"Dave" <dave@.nodomain.tv> wrote in message
news:%23H8rx9bFEHA.2576@.TK2MSFTNGP11.phx.gbl...
> This won't work...
> SELECT count(distinct z.id, c.alias, c.type)
> FROM customer c JOIN zsource z ON c.id=z.id
> How can I count the number of distinct combinations of 3 separate fields?
>|||Thanks much
"Nags" <nags@.DontSpamMe.com> wrote in message
news:O4lRaPcFEHA.2560@.TK2MSFTNGP12.phx.gbl...
> This should work :
> SELECT count(*) FROM (
> SELECT distinct z.id, c.alias, c.type
> FROM customer c JOIN zsource z ON c.id=z.id) a
> -Nags
> "Dave" <dave@.nodomain.tv> wrote in message
> news:#H8rx9bFEHA.2576@.TK2MSFTNGP11.phx.gbl...
fields?
>
Showing posts with label distincts. Show all posts
Showing posts with label distincts. Show all posts
Tuesday, February 14, 2012
Subscribe to:
Posts (Atom)