change ids to id (fix) and add orderby created_on to stmt