I have two tables:
table Filters
id INT(11) PRIMARY KEY
text VARCHAR(50)
table items
id INT(11) PRIMARY KEY
title VARCHAR(255)
I’d like to dipslay all filter terms along with count fo their occurence among titles
I’m currently using this statement but I get zeroes as counts
SELECT filters.text,
(SELECT COUNT(items.id)
FROM items
WHERE (items.title LIKE 'filters.text' OR
items.title LIKE '%filters.text' OR
items.title LIKE '%filters.text%' OR
items.title LIKE 'filters.text%')
) AS count
FROM filters, items
GROUP BY filters.ID
ORDER BY filters.ID DESC
give this a try,