I want to be able to pick peoples in table 1 that did not gave or asked ID#1(jud) for loans. MY 2 tables.
table 1
----------------------
id*|name|adress
1 |jud |pipi #5
2 |john|yoba #45
3 |jan |stackyflow 54
4 |Song|doesnt matter street 98
Table 2
-------------
*id|asked_loan|gave_loan
1 |1 |2
2 |1 |3
In this case i will want to get only Table1 row #4 which is :
4 |Song|doesnt matter street 98
What i tried :
SELECT DISTINCT `id`,`name`,`adress`
FROM `TABLE1`
LEFT JOIN `TABLE2` ON TABLE1.asked_loan = TABLE1.id
WHERE `asked_loan` !=1 AND `gave_loan` !=1
My problem: Since i am left joining, the 2 tables hook together so users not present in TABLE2 will not show up.
Summary: I want to be able to select users that did not gave or receive (TABLE1 id)#1 a loan