TheJuan Posted June 7, 2006 Share Posted June 7, 2006 hii just wondering how can it be possible to make a query of this situation.I have a list of student name in tbl_students and a table tbl_payments where stored a list of students(id,name,amount) who already pay for a fee.i want to display those all name of students that are in tbl_students but not yet in tbl_paymentssomething like:select id,name from tbl_student where id is not present in tbl_paymentsthanks Quote Link to comment https://forums.phpfreaks.com/topic/11378-display-student-name-that-is-not-present-in-tbl_studentfees/ Share on other sites More sharing options...
fenway Posted June 9, 2006 Share Posted June 9, 2006 This calls for a LEFT JOIN (UNTESTED):[code]SELECT s.id, s.name FROM tbl_student AS s LEFT JOIN tbl_payments AS p ON s.id = p.student_idWHERE p.student_id IS NULL[/code]Hope that helps. Quote Link to comment https://forums.phpfreaks.com/topic/11378-display-student-name-that-is-not-present-in-tbl_studentfees/#findComment-43540 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.