|
Posted by Frankie on 05/19/07 12:57
Hi Tyno
you could try
SELECT
COUNT(modpr_prereq or null) as prereq_count,
COUNT(mods_slide or null) AS step_count,
FROM module
LEFT JOIN mod_prereqs ON
mod_prereqs.modpr_mod = module.mod_seq
LEFT JOIN mod_slide ON
mod_slide.mods_mod_seq = module.mod_seq
GROUP BY mod_seq;
Frankie
http://puity.com
"Tyno Gendo" <you@localhost> a ιcrit dans le message de news:
SIednU9JC4YG7dTbRVnytgA@bt.com...
> hi
>
> i'm just wondering, is it possible to count the number of rows without
> NULL/blanks in for two columns in one select?
>
> I tried: SELECT module.*, COUNT( modpr_prereq ) AS prereq_count, COUNT(
> mods_slide ) AS step_count FROM module LEFT JOIN mod_prereqs ON
> mod_prereqs.modpr_mod = module.mod_seq LEFT JOIN mod_slide ON
> mod_slide.mods_mod_seq = module.mod_seq GROUP BY mod_seq;
>
> But this just returns same count for both prereq_count and step_count
>
> I also tried to look at
>
> SELECT prereq_count=(SELECT COUNT(*) FROM mods_prereqs),
> step_count=(SELECT COUNT(*) FROM mods_slide) ....
>
> MySQL doesn't support this 2nd style?
>
> Is there any way to get two column counts and a set of data in one SELECT
> under MySQL?
>
> Thanks in advance for any help.
[Back to original message]
|