Query SELECT si.id item_id, si.item_title, si.item_cost, p.filename photo_filename, us.id item_shop_id, us.shop_title item_shop_title, us.shop_text_id item_shop_text_id FROM shop_items si INNER JOIN shop_items_to_photos sip ON sip.item_id = si.id INNER JOIN photos p ON sip.photo_id = p.id INNER JOIN user_shops us ON si.shop_id = us.id INNER JOIN shop_items_to_tags sit ON sit.item_id = si.id INNER JOIN tags t ON sit.tag_id = t.id WHERE 1=1 AND NOW() >= si.item_available_from AND si.item_removed = 0 AND t.tag_name = 'father's day' ORDER BY si.item_title failed with error You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near 's day' ORDER BY si.item_title' at line 15