Is it possible to count the number of results matched in table B from values drawn from table A in the same query?
For example -
tableA
--------------
color | type
-------|------
blue | car
red | truck
orange | car
green | car
-
tableB
--------------
color | sku
-------|------
blue | 1
red | 2
orange | 3
green | 4
orange | 5
green | 6
Question - How many rows in tableB are related to type = car? Result should return 5.
Using two queries and some PHP this is pretty straightforward, I was just curious if this is possible with a single MySQL query, and if it would be more efficient.