lenerd3000 Posted February 5, 2008 Share Posted February 5, 2008 hi, suppose i have 2 table. i want to get all the records from table1 where table1's id is not exist in table2. how can do that. my code is like this: SELECT * FROM students WHERE status = 'Verified' AND not EXISTS(SELECT studentid FROM records WHERE (fname = 'joe')) nothing happen for that. pls help. mysql version is 5.0 Quote Link to comment https://forums.phpfreaks.com/topic/89454-solved-mysql-exists-function-problem/ Share on other sites More sharing options...
lenerd3000 Posted February 5, 2008 Author Share Posted February 5, 2008 ok i got it. SELECT * FROM students WHERE status = 'Verified' AND NOT EXISTS(SELECT studentid FROM records WHERE (reocrds.fname = 'joe' AND records.studentid = students.id)) Quote Link to comment https://forums.phpfreaks.com/topic/89454-solved-mysql-exists-function-problem/#findComment-458126 Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.