SELECT * FROM DOCUMENTS INNER JOIN DOCUMENT_TYPES ON DOCUMENTS.doc_typ_id = DOCUMENT_TYPES.doc_typ_id INNER JOIN AUTHORS ON DOCUMENTS.aut_id = AUTHORS.aut_id WHERE AUTHORS.aut_id = AND DOCUMENTS.doc_published = 1 ORDER BY doc_typ_name, doc_order, doc_date DESC, doc_title 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 DOCUMENTS.doc_published = 1 ORDER BY doc_typ_name, doc_order, doc_date DES' at line 5