次の結果セットからpidがNULLであるレコードが必要です。
pid users_fee_schedule_students_name users_fee_schedule_students_uid
8 users 6 MBA in IT 1 1337097600 3 6 user 250000
9 users 6 MBA in IT 2 1337184000 3 7 user 250000
NULL ashuser 277 MBA in IT 1 1337097600 3 6 user 250000
NULL ashuser 277 MBA in IT 2 1337184000 3 7 user 250000
10 sriuser 66 MBA in IT 1 1337097600 3 6 user 250000
NULL sriuser 66 MBA in IT
上記の結果セットを取得するためのSQLクエリは
SELECT FSP.pid, users_fee_schedule_students.name AS users_fee_schedule_students_name, users_fee_schedule_students.uid AS users_fee_schedule_students_uid, fee_schedule.name AS fee_schedule_name, fee_schedule_instalments.instalment_no AS fee_schedule_instalments_instalment_no, fee_schedule_instalments.payable_by AS fee_schedule_instalments_payable_by, fee_schedule.fid AS fid, fee_schedule_instalments.iid AS fee_schedule_instalments_iid, 'user' AS field_data_field_school_course_user_entity_type, SUM(fee_schedule_instalments.amount) AS fee_schedule_instalments_amount
FROM
ic_fee_schedule AS fee_schedule
LEFT JOIN ic_fee_schedule_students AS fee_schedule_students ON fee_schedule.fid = fee_schedule_students.fid
LEFT JOIN ic_users AS users_fee_schedule_students ON fee_schedule_students.uid = users_fee_schedule_students.uid
LEFT JOIN ic_fee_schedule_instalments AS fee_schedule_instalments ON fee_schedule.fid = fee_schedule_instalments.fid
LEFT JOIN ic_fee_schedule_payments AS FSP ON fee_schedule.fid = FSP.fid AND fee_schedule_students.uid = FSP.uid AND fee_schedule_instalments.iid = FSP.iid
WHERE (( (fee_schedule.fid = '3' ) ))
GROUP BY users_fee_schedule_students_name, users_fee_schedule_students_uid, fee_schedule_name, fee_schedule_instalments_instalment_no, fee_schedule_instalments_payable_by, fid , fee_schedule_instalments_iid
LEFT JOIN ic_fee_schedule_payments AS FSPは、他のタイプの参加で変更する必要があると思います。それをチェックしています.....
よろしくお願いします。