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 'order by assoc_award.order asc' at line 14 Q= SELECT wine.ID as ID ,award.award as award ,award.punctuation as punctuation ,award.description as description ,media_award.file as file FROM vinnico_wine as wine LEFT JOIN vinnico_award_catassoc as assoc_award ON (assoc_award.ID_parent = wine.ID) LEFT JOIN vinnico_award as award ON award.ID=assoc_award.ID_award LEFT JOIN vinnico_media_catassoc as assoc_media_award ON (assoc_media_award.TABLE_parent = 'vinnico_award' AND assoc_media_award.FIELD_parent = 'medal_image' AND assoc_media_award.ID_parent = award.ID) LEFT JOIN vinnico_media as media_award ON ( assoc_media_award.ID_media=media_award.ID ) WHERE wine.ID= order by assoc_award.order asc