I was having trouble wording my title. I'll try my best to describe my problem. I'm a SQL newbie, so go easy on me..
I'm trying to match records that "doesn't exist" between two relational tables. For instance, if I have two tables.
Table 1: Client_ID Client_Name Table 2: Purchase_ID Purchase_Name CLIENT_ID
As you see, I'm trying to match records from Table 2 in which a client doesn't have a purchase.
SELECT CLIENT_ID FROM CLIENT JOIN PURCHASE USING(CLIENT_ID) GROUP BY CLIENT_ID NOT HAVING PURCHASE_ID ORDER BY CLIENT_ID DESC;
Here is some data to further more explain what I'm trying to accomplish.
Ok for instance.
Client_ID Client_Name 1 Bob 2 Dan 3 Joe
Purchase_ID Purchase_Name CLIENT_ID 1 Shelf 2 2 Book 1
So, in this case I want to find what client didn't make a purchase.
Which would be Client 3, Joe.
Obviously what I've coded is wrong, I'm just looking for basic guidence on how to match records in this instance. Maybe because I'm been working for 6 hours straight and I'm overlooking, I'm not sure. Thanks in advance for your help.