I got this answer from somebody on another Q before, but I would like to get an explanation of this, so that I fully understand the problem.
I have a table, with a column which contains a value of either "private" or "company". Thing is, I want to check how many "private" and "company" values are in my records, so that I can display them with the search results later on. So if there are 4 company ads, and 1 private ad, this is the results:
Company = 4
Private = 1
All ads = 5
And here is the code I got from someone about how to do this, in other words, this is what I would like explained:
SELECT
IFNULL( field , 'All ads' ) AS 'Type',
COUNT( * )
FROM
`table`
GROUP BY
field
WITH ROLLUP
Thanks