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`)

Link to comment
Share on other sites

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

Link to comment
Share on other sites

This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • 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.