List:General Discussion« Previous MessageNext Message »
From:Graeme B. Davis Date:March 2 2000 3:19pm
Subject:Re: COUNTing
View as plain text  
Thanks for the info!

Is there a way to return this information in the same row

Right now it returns info like this:

| son          | Email  |       12 |
| son          | Phone  |        2 |

But I would want it to return like:

| son          | 12 | 2 |

Any ideas?

> What you're really doing is looking to count groups of "person"
> and "medium". Given that, how about something like:
> 
>  SELECT person, medium, COUNT(*)
>  FROM table
>  WHERE medium IN ('Phone', 'Email)
>  GROUP BY person, medium;
> 
> 
> -- 
> 
> Jonathan Stimmel                    Pager:  415-253-7202
> jon@stripped                   jstimmel.page@stripped 
> 
> 1180 Reed Ave #55                    Home:  408-244-5258
> Sunnyvale, CA 94086                  Cell:  650-520-4164
> 
> -- 
> ---------------------------------------------------------------------
> Please check "http://www.mysql.com/Manual_chapter/manual_toc.html" before
> posting. To request this thread, e-mail mysql-thread29714@stripped
> 
> To unsubscribe, send a message to:
>     <mysql-unsubscribe-GraemeD=uu.net@stripped>
> 
> 

Thread
COUNTingGraeme B. Davis2 Mar
  • Re: COUNTingJonathan Stimmel2 Mar
  • Re: COUNTingGraeme B. Davis2 Mar
    • RE: COUNTingNicolas Prade2 Mar