writing query to extract data for 241 analysis