Amended SQL for resource