I have an ad database that contains two category fields (an ad could appear in two different categories). I am trying to get combined counts by category in mySql. I am trying to turn this four column result into a two column result.
PHP Code:SELECT c1 AS cat1, count( c1 ) AS ct, c2 AS cat2, count( c2 ) AS ct
FROM ads
GROUP BY cat1, cat2


Reply With Quote