SQLize Online / PHPize Online  /  SQLtest Online

A A A
Share      Blog   Popular
Copy Format Clear
SELECT s.student_id, student_name, gender, mobile_number, email_address, birth_date, qualification, r.registration_id, registration_date, discount, c.course_id, course_name, cf.fee_id, fee_mode, gst, fees_amount, (fees_amount * (1 + gst / 100)) AS total_fees_before_discount, (fees_amount * (1 + gst / 100)) - discount AS total_fees_after_discount, ( SELECT SUM(p.payment_amount) FROM tblstudent_payments p WHERE p.registration_id = r.registration_id ) AS total_paid_fees, ( (fees_amount * (1 + gst / 100)) - discount - ( SELECT SUM(p.payment_amount) FROM tblstudent_payments p WHERE p.registration_id = r.registration_id ) ) AS remaining_fees, p.payment_date, payment_mode, p.payment_amount, p.payment_description FROM tbltraining_courses c JOIN tbltraining_course_fees cf ON c.course_id = cf.course_id JOIN tbltraining_course_topics ctopic ON c.course_id = ctopic.course_id JOIN tbltraining_topics tp ON ctopic.topic_id = tp.topic_id JOIN tbltopic_contents ct ON tp.topic_id = ct.topic_id JOIN tblstudent_registrations r ON cf.fee_id = r.fee_id JOIN tblstudent_details s ON s.student_id = r.student_id LEFT JOIN tblstudent_payments p ON r.registration_id = p.registration_id

Stuck with a problem? Got Error? Ask ChatGPT!

Copy Clear