Hi QCubed Gurus,
I have an assciation table LR_CHALLAN_ASSN which has keys from tables LR and CHALLAN.
I need to figure out how to get the unassociated LRs which are not mapped to any challan. Any help on this guys..
After an 8 hour research I found that Mysql does not support MINUS statement duh... Here's the alernative which can save time..
SELECT DISTINCT lr.id FROM lr WHERE (lr.id) NOT IN (SELECT lr_id FROM lr_challan_assn);
Hello,
In MySQL you use a LEFT JOIN for this like in here:
SELECT * FROM person LEFT JOIN team_member_project_assn ON team_member_project_assn.person_id=person.id WHERE person_id IS NULL
Might be better performance wise as MySQL is not that great with sub-selects.
Cheers
Helge
© 2012 QCubed - All Rights Reserved. Valid XHTML 1.0 Strict | Valid CSS 2.1
Theme developed by pM using entirely open source solutions.
After an 8 hour research I found that Mysql does not support MINUS statement
duh...
Here's the alernative which can save time..
SELECT DISTINCT lr.id
FROM lr
WHERE (lr.id) NOT IN
(SELECT lr_id FROM lr_challan_assn);
Hello,
In MySQL you use a LEFT JOIN for this like in here:
SELECT *
FROM person
LEFT JOIN team_member_project_assn
ON team_member_project_assn.person_id=person.id
WHERE person_id IS NULL
Might be better performance wise as MySQL is not that great with sub-selects.
Cheers
Helge