I'm using three tables in the database and query that I need should combine all three tables. The tables look like:
Table A:
id | name | status
---------------------------------
5 | john | 1
7 | mike | 1
8 | jane | 0
Table B:
send-id | receive-id | notification
-------------------------------------------
12 | 5 | 1
5 | 23 | 1
8 | 14 | 1
19 | 7 | 2
14 | 5 | 1
Table C:
registered-id | status-reg
----------------------------------
5 | 7
7 | 7
8 | 7
9 | 3
I need to list the users who have the status "1" from the table A and the status "7" from the table C and that these users are not listed in the table B column "receive-id" with the value "2" in column "notification".
The result in this example will be:
id | name | status | notification
--------------------------------------------------
5 | john | 1 |
Users with ID numbers 7 and 8 would be excluded from the list. User with ID# 7 because it is located in Table B in the field receive-id with a value of 2 in table notification and the user with ID 8 because it has a status 0 in Table A.
How can I do that in one query?
Thanks for any help.