very good article. I was trying to copy your logic, but stuck on one problem. if you want to limit your list with IN operator, so count the smoking status only for selected patients and for others not, and to have it one report, how to change this code? pls advise.