Jump to content

[SOLVED] Can Anyone help me with a not equal query


newbreed65

Recommended Posts

Hi Everyone

 

In PhpMyAdmin I’m trying to get a list of clients from the clients table that don’t have any claims linked to them in the Claims table, I can get all the ones that have claims but don’t know how to get the ones that don’t have claims

 

Any Help?

 

Here are a few of my failed attempts

 

 

 

SELECT`Clients`.*, `Claims`.`ClientID`
FROM `Clients`
WHERE`Clients`.`ID`!=`Claims`.`ClientID`)


SELECT`Clients`.* 
FROM `Clients`
JOIN `Claims`
ON (`Clients`.`ID`!=`Claims`.`ClientID`)

You need a LEFT OUTER JOIN.  Something like this may work

 

 

SELECT c.*
FROM Clients c LEFT JOIN (Claims cl)
ON (cl.ClientId = c.ID AND cl.ClientId IS NULL)

 

 

Thanx for that just before i looked on your post i tried the same thing and it look like its worked havent  double checked thou lol

Archived

This topic is now archived and is closed to further replies.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.