Ask a Question
Advertise on boostr.in
mysql join where not exists using -'mysql,join,not-exists'
mysql join where not exists ¬†using -'mysql,join,not-exists'
I have a MySQL query that joins two tables
they join on voters.household_id and household.id
Now what i need to do is to modify it where the voter table is joined to a third table called elimination, along voter.id and elimination.voter_id, how ever the catch is that i want to exclude any records in the voter table that have a corresponding record in the elimination table. how do i craft a query to do this?
this is my current query
SELECT `voter`.`ID`, `voter`.`Last_Name`, `voter`.`First_Name`,
¬†¬†¬†¬†¬†¬†¬†`voter`.`Middle_Name`, `voter`.`Age`, `voter`.`Sex`,
¬†¬†¬†¬†¬†¬†¬†`voter`.`Party`, `voter`.`Demo`, `voter`.`PV`,
¬†¬†¬†¬†¬†¬†¬†`household`.`Address`, `household`.`City`, `household`.`Zip`
JOIN `household` ON `voter`.`House_ID`=`household`.`id`
WHERE `CT` = '5'
AND `Precnum` = 'CTY3'
AND ¬†`Last_Name` ¬†LIKE '%Cumbee%'
AND ¬†`First_Name` ¬†LIKE '%John%'
ORDER BY `Last_Name` ASC
Sep 7, 2015
to add a comment.
Your name to display (optional):
Email me at this address if my answer is selected or commented on:
Email me if my answer is selected or commented on
Privacy: Your email address will only be used for sending these notifications.
To avoid this verification in future, please