Integrate the queries for cases