Hi
I have this select:

SELECT tab1.field, tab2.field, tab3.field
FROM table
JOIN....
JOIN....
WHERE tab4.type=b
GROUP BY etc....
ORDER BY etc....

Now, the tab4 has three fields: id, color, type.
I want to select where type=b and to count all the occurrences of
color in the same query.

Example: with this tab4:

ID    Color     Type
1      black      a
1      yellow     a
1      white       a
1      gray1       b
23     ciano      a
23     red         a
23     gray4      b

I would want to obtain this:

id    TotColor     Type
1       3             gray1
23     2             gray4



How can i do?
Thanks

--
http://www.spacemarc.it

--
MySQL General Mailing List
For list archives: http://lists.mysql.com/mysql
To unsubscribe:    http://lists.mysql.com/[EMAIL PROTECTED]

Reply via email to