I have two tables. I want to get the UIDs from table 1 where the subject columns from both tables match.
Table 1
UID SubjectA
1 Cows
2 Chickens
3 Mice
4 Rabbits
5 Cows
Table 2
Name SubjectB
A Cows
B Cows
C Cows
D Cows
E Mice
Expected Result*
Fetch UIDs: 1, 3, 5.
I don’t quite understand joins and unions. Both seem to combine two tables. What is the right way of doing this?
There are several ways to do this…
First, I’d suggest using
exists:Or, you can use a
joinanddistinct:Lastly, you can use
in: