I am trying to combine 2 SQL queries into 1. I am giong to try and explain this as best as I can. I have 2 different queries where one returns the count of patients and the other returns the count of deviations. When I try to combine the 2 queries into one SQL statement I get multiples results for deviations. The patients are unique, but each patient can have multiple deviations (probably why it gets mutiplied for me).
The deviations SQL code is identiical to the patients query expect it adds a left outer join at the end to get the deviations (see attached).
I am looking for a way to combine these into one SQL statement. Let me know what other info you need. Thanks.