SQL - filtering data based on AND condition

Original text of this message