Query Error in 'CPSetSelection::execute' method in '/mnt/ccd-vhost-data/www/vhosts/connacht.reskin.ccd07.ccd.systems/httpdocs/class.cp_sets.php' on line 8741, You have an error in your SQL syntax; check the manual that corresponds to your MariaDB server version for the right syntax to use near 'ORDER BY mainTable.cpda_seq, mainTable.cpda_id' at line 1

Full query: SELECT mainTable.cpda_id FROM cp_data AS mainTable LEFT OUTER JOIN cp_data AS table0 ON table0.cpda_meta_id = mainTable.cpda_id AND table0.cpda_meta_key = '59896' LEFT OUTER JOIN cp_data AS table1 ON table1.cpda_meta_id = mainTable.cpda_id AND table1.cpda_meta_key = '59909' WHERE mainTable.cpda_meta_id = 59887 AND mainTable.cpda_meta_key = 'set_element_stub' AND mainTable.cpda_active = 1 AND table0.cpda_meta_val = 105193 AND table1.cpda_meta_val =  ORDER BY mainTable.cpda_seq, mainTable.cpda_id