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 'GROUP BY id_size ORDER BY id_size ASC' at line 1syntax error: select id_size from table_properties where id_product = GROUP BY id_size ORDER BY id_size ASC