SELECT t2.id, t2.name, t2.filename, t2.video_thumb FROM `andmedical_dtools_doc_center_document_categories` AS t1 JOIN `andmedical_dtools_doc_center_documents` AS t2 ON t1.document_id = t2.id WHERE t1.category_id = AND t2.file_type = 'video' ORDER BY t1.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 t2.file_type = 'video' ORDER BY t1.order' at line 1