I'm newish to this and using Oracle SQL. I have the following tables:
Table 1 CaseDetail
CaseNumber | CaseType
1 | 'RelevantToThisQuestion'
2 | 'RelevantToThisQuestion'
3 | 'RelevantToThisQuestion'
4 | 'NotRelevantToThisQuestion'
Table 2 LinkedPeople
CaseNumber | RelationshipType | LinkedPerson
1 | 'Owner' | 123
1 | 'Agent' | 124
1 | 'Contact' | 125
2 | 'Owner' | 126
2 | 'Agent' | 127
2 | 'Contact' | 128
3 | 'Owner' | 129
3 | 'Agent' | 130
3 | 'Contact' | 131
Table 3 Location
LinkedPerson| Country
123 | 'AU'
124 | 'UK'
125 | 'UK'
126 | 'US'
127 | 'US'
128 | 'UK'
129 | 'UK'
130 | 'AU'
131 | 'UK'
I want to count CaseNumbers that are relevant to this question with no LinkedPeople in 'AU'. So the results from the above data would be 1
I've been trying to combine aggregate functions and subqueries but I think I might be over-complicating things.
Just need a push in the right direction, thanks!