Help selecting what is NOT in two tables
Posted 04 March 2013 - 01:18 PM
I have two tables:
CLID | CLDate
CLID | Description | Instructor
I'm trying to figure out a single SQL statement that would return all CLIDs that exist in ClassDetail but NOT in Classes.
I'm in the process of fudging it in PHP, but I know there's a better way...
Posted 04 March 2013 - 01:22 PM Best Answer
SELECT ClassDetail.CLID FROM ClassDetail LEFT JOIN Classes ON Classes.CLID = ClassDetail.CLID WHERE Classes.CLID IS NULLNot tested.
How to Get Good Help: How to Ask Questions | Don't be a help vampire
Debugging Your Code: Debugging your SQL | What does a php function do? | What does a term mean? | Don't see any errors?
Things You Should Do: Normalize Your Data | use print_r() or var_dump()
Lulz: "Functions should not have side effects." - trq
Please take a look at my new PHP/Web Dev blog: The Web Mason - Thanks!!
0 user(s) are reading this topic
0 members, 0 guests, 0 anonymous users