SQL query to count unique IDs that meet criteria in 2 columns where criteria are not always present on same row in SQL Posted September 11, 2019 · Report reply Thanks for the input. I agree it's not an optimal way to store data. My example may not have been great. The actual dataset is timestamped event data (think transaction logs), so it's not uncommon for some events for a given customer to have certain columns be null, and present on other events. I'm thinking this just might not be feasible with the dataset I have (which has lots of columns).