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 'order by name asc' at line 1select id from pixilink_360.building where group_id = order by name asc