I've got a query, below that's taking ages to bring back results. I think I've done something wrong, but am not sure.
It uses 3 tables, offers, products and tags
I've created 4 table aliases for tags so I can query them. Any help on this would be very welcome.
SELECT p.product_name, p.page, p.description, p.brand_name, p.model,
o.price_with_delivery,
t1.tag, t2.tag,t3.tag,t4.tag
FROM offers o JOIN products p
ON o.product_name = p.product_name
JOIN tags t1
ON t1.product_name = p.product_name
JOIN tags t2
ON t2.product_name = p.product_name
JOIN tags t3
ON t3.product_name = p.product_name
JOIN tags t4
ON t4.product_name = p.product_name
WHERE p.cat1 = 'product category'
AND o.display_price > 5 AND t2.tag = 'some feature' AND t3.tag = 'another feature' GROUP BY o.product_name ORDER BY p.size ASC LIMIT 0, 10