I have a table called 'sets' with 3 fields - spb, pat and set. An example of the table is shown below:
spb pat set
1 123 ue
1 123 lft
2 123 ue
3 123 ue
4 1234 ue
4 1234 lft
5 123 ue
6 1234 lft
For each 'set' I would like to output the total number of requests (a request is defined as having a unique 'spb' value) and the total number of unique patients (a patient is defined as having a unique 'pat' value), using a single query (if possible). In the above example the output should be:
set Requests Patients
ue 5 2
lft 3 2
Thanks for any help with this.
spb pat set
1 123 ue
1 123 lft
2 123 ue
3 123 ue
4 1234 ue
4 1234 lft
5 123 ue
6 1234 lft
For each 'set' I would like to output the total number of requests (a request is defined as having a unique 'spb' value) and the total number of unique patients (a patient is defined as having a unique 'pat' value), using a single query (if possible). In the above example the output should be:
set Requests Patients
ue 5 2
lft 3 2
Thanks for any help with this.