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 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)) 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
Archived
This topic is now archived and is closed to further replies.