|
Posted by Captain Paralytic on 05/15/07 09:19
On 15 May, 09:35, Tyno Gendo <you@localhost> wrote:
> 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.
Depending on your version of MySQL you can use subselects, just not in
that syntax.
Navigation:
[Reply to this message]
|