List:General Discussion« Previous MessageNext Message »
From:Jim Faucette Date:May 30 1999 3:18am
Subject:Re: Multiple counts as an array
View as plain text  
Darren Sweeney wrote:
> 
> Yes, I thought of that but that does not return a 0 if there is no item with
> that category ... e.g. I have a full listing on a page, I need a user to see
> if there are no pc_digital_camera for example ... the GROUP BY would only
> return them if they were there ...
> 
> Does my theory sound correct?
> 

I see what you're after. If you have a separate table of descriptions
you could do something like:
  SELECT t2.descrip, count(t1.descrip) 
  FROM t2 LEFT JOIN t1 USING (descrip) 
  GROUP BY t1.descrip;
That will give 0 counts for descriptions in t2 that have no entries in
t1.

  jim...
Thread
Multiple counts as an arrayDarren Sweeney30 May
  • Re: Multiple counts as an arrayJim Faucette30 May
  • Re: Multiple counts as an arrayAlexander I. Barkov30 May
    • LIKE or = ?Stefan Schmiedl31 May
  • Re: Multiple counts as an arrayJim Faucette30 May
  • Re: Multiple counts as an arrayGraham Ashton30 May
Re: Multiple counts as an arrayDarren Sweeney30 May
  • Re: Multiple counts as an arrayJim Faucette30 May
  • Re: Multiple counts as an arrayJim Faucette30 May
Re: Multiple counts as an arrayDarren Sweeney30 May
  • Re: Multiple counts as an arraySasha Pachev30 May