newbreed65 Posted June 11, 2009 Share Posted June 11, 2009 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 https://forums.phpfreaks.com/topic/161787-solved-can-anyone-help-me-with-a-not-equal-query/ Share on other sites More sharing options...
gizmola Posted June 11, 2009 Share Posted June 11, 2009 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) Link to comment https://forums.phpfreaks.com/topic/161787-solved-can-anyone-help-me-with-a-not-equal-query/#findComment-853641 Share on other sites More sharing options...
newbreed65 Posted June 11, 2009 Author Share Posted June 11, 2009 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 https://forums.phpfreaks.com/topic/161787-solved-can-anyone-help-me-with-a-not-equal-query/#findComment-853646 Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.