QUERY FOR SUMMARIZING DATA