joining 2 tables - help please..
| From: | rainydays_sunshine at hotmail dot com | Date: | Wed, 18 Sep 2002 08:09:50 +0000 |
| Subject: | joining 2 tables - help please.. | ||
| Groups: | php.db | ||
| Request: | Send a blank email to php-db+get-21821@lists.php.net to get a copy of this message | ||
I have 2 tables as follows:
product table
| product_id | name | category_id
| 1 | coffee| 2
| 3 | orange|1
| 5 | mango|1
| 2 | tea |2
and
category table
|category_id | category_name |
|2 | drinks |
|1 | fruit |
|4 | desert |
|5 | main |
I want to get how many product in each category using sql statement, but I
keep getting NULL for the one that doesn;t have product link. I want to get
result from all category like this: drinks (2), fruit(2), desert(0),
main(0).
Help please...