You have an error in your SQL syntax near 'ORDER BY reference ASC' at line 1