Posted by john7 on 03/02/07 17:19
I have three tables one for categories, one for products1 and another
for products2. I am using PHP and MySQL.
so for example I
categories
categoryid name
1 programming
2 databases
3 os
products1
id name categoryid
1 php 1
2 mysql 2
3 linux 3
4 javascript 1
products2
id name categoryid
1 java 1
2 linux 3
3 windows 3
I need to join these tables such that I can get the count of name by
categories
for example the result table should like
categoryid (count name for products 1) (count name for products 2)
1 2 1
2 1 0
3 1 2
Is there a way to do get this result in one SQL statement?
Thanks
John
Navigation:
[Reply to this message]
|