List:General Discussion« Previous MessageNext Message »
From:Gerald Clark Date:June 7 2002 5:43pm
Subject:Re: Counting distinct elements
View as plain text  
You mean

SELECT ObjId,ElemId,count( distinct Objid,ElemId ) from Elems group by 
ObjId;

?


Csaba Gabor wrote:

>Seems like this should be an easy question, but I just don't get it:
>
>If I have CREATE TABLE Elems (ObjId INT, ElemId INT);
>Is there a nice query to find the Number of Distinct ElemId's for each ObjId?
>
>Motivation: Later I will want to add a WHERE ObjId IN (...) and join the Obj
> describing table to
>the results of this query.
>
>Thanks,
>    Csaba Gabor from New York
>
>__________________________________________________
>Do You Yahoo!?
>Yahoo! - Official partner of 2002 FIFA World Cup
>http://fifaworldcup.yahoo.com
>
>---------------------------------------------------------------------
>Before posting, please check:
>   http://www.mysql.com/manual.php   (the manual)
>   http://lists.mysql.com/           (the list archive)
>
>To request this thread, e-mail <mysql-thread111345@stripped>
>To unsubscribe, e-mail
> <mysql-unsubscribe-gerald_clark=suppliersystems.com@stripped>
>Trouble unsubscribing? Try: http://lists.mysql.com/php/unsubscribe.php
>
>


Thread
Counting distinct elementsCsaba Gabor7 Jun
  • Re: Counting distinct elementsGerald Clark7 Jun
  • Re: Counting distinct elementsDavid M. Peak7 Jun