For example we have this 2 tables
table1:
Dir_num | dir_name
10 | john
11 | vlad
table2:
game | dir_num
101 | 10
111 | 10
102 | 11
104 | 10
104 | 10
Now I try to find the dir_name who has less than 2 games played.
select * from table1 where dir_num ....
Please help me find pl/sql code.
The output should show
Vlad.
Try something like this — use
GROUP BYandHAVING:And here is the SQL Fiddle.
If you want those in both tables (meaning at least 1 game), then change LEFT JOIN to INNER JOIN.
Good luck.