On Monday 31 May 2004 04:32 pm, Oliver Elphick wrote:
> On Thu, 2004-05-27 at 17:38, Jeannie Stevenson wrote:
> ...
>
> > In MSSQL I would use
> >
> > select
> > count_1=(select count(ad_code) AS "CP" from leads where ad_code =
> > '555'),
> > count_2=(select count(ad_code) AS HED" from leads where ad_code =
> > '222'),
> > etc
>
> SELECT
> (select count(ad_code) AS "CP"
> from leads where ad_code = '555') AS count_1,
> (select count(ad_code) AS HED"
> from leads where ad_code = '222') AS count_2,
> ...etc...
Or, if you want a count of every ad_code:
SELECT ad_code, COUNT(ad_code) FROM leads GROUP BY ad_code;
-miker