如果未在另一个表中列出,则显示数据

I am wondering how to check if data exists in another table.

Basically I have 2 tables. 1 = networks and 2 = usernetworks

$networks = $this->db->query("SELECT companyname,description,commision FROM (`networks`)");

In my table usernetworks it has a column userID and networkid

I want to check if the id from networks and the userid = '9' is listed in the usernetworks table.

Basically I want to display the networks that the user is not already a member of.

I would use not exists:

select n.*
from networks n
where not exists (select 1
                  from usernetworks un
                  where un.networkid = n.networkid and un.userid = 9
                 );