SELECT
linked_boxes.*,
right_boxes.*
FROM linked_boxes as linked_boxes
LEFT JOIN right_boxes as right_boxes
ON linked_boxes.box_parent = right_boxes.id
WHERE linked_boxes.link_cat_parent =
AND position = 'R' AND link_active = 'Y' ORDER BY link_sort_order
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 'AND position = 'R' AND link_active = 'Y' ORDER BY link_sort_order' at line 8