Guest_imported
New member
- Jan 1, 1970
- 0
I'm totally stuck with a particular problem.
I have two tables (Simplified for this example) called wm_a and wm_b
wm_a has 3 fields:
id
category
description
wm_b has 2 fields:
id
category_name
Now, I want to select all the rows in wm_b AND how many rows there are in wm_a which have a corresponding category number to wm_b's id.
So I get a result looking like:
The 'count' column being the number of rows in wm_a who's category field corresponds to the id column.
Thank you greatly in advance
I have two tables (Simplified for this example) called wm_a and wm_b
wm_a has 3 fields:
id
category
description
wm_b has 2 fields:
id
category_name
Now, I want to select all the rows in wm_b AND how many rows there are in wm_a which have a corresponding category number to wm_b's id.
So I get a result looking like:
Code:
+--+-------------+-----+
|id|category_name|count|
+--+-------------+-----+
| 1|MyCategory01 | 2|
| 2|MyCategory02 | 1|
| 3|MyCategory03 | 4|
| 4|MyCategory04 | 0|
+--+-------------+-----+
Thank you greatly in advance