I have four tables in my database:
student: contain the student’s ID and name, etc.student_fee: contains the paid_date, student_id and fee_id with references to thestudentandfeetablesfee: contains the fee_id, fee amount, fee_typeid (ref tofee_typetable)fee_type: contain the fee_typeid and type of fees – admission fee, monthly tuition fee, fines, uniform fees, etc.
How do I display the students who have already paid the admission fee (or fee_typeid for admission fee) and those who have not paid it?
Well .. English is not my first language 😉
I believe this is what you need. This is a method of doing
joins without actually writing the join syntax.Basically, you are selecting all the fee_id where they are of the type that you want. Then, you are selecting all the student_id where the fee_id matches the ones you just selected. Finally, you pull all the information about the students whose student_id is one of the ids you just pulled.