J
Jim Shady
Hi there,
I've made a query but it doesn't really work. When I run it, it always gets
to the end but never completely finishes? Hope that makes sense. I think it's
because of the amount of data that it is trying to show me or something. It
is sorting through hundreds of thousands of records and the trying to return
a few thousand or so.
I wonder if anyone had any suggestions as to how to make it work?
SQL below if it helps?
Jim Shady
SELECT DISTINCT app.app_id, app.forename, app.surname, crs.title,
lkp_lookups_2.short_descr, app_crs_enrol.start_date,
app_crs_enrol.offer_date, lkp_lookups_3.short_descr,
lkp_lookups_4.short_descr, app_crs_enrol.app_decision_date,
app_crs_enrol.application_rcvd_date, app_crs_enrol.reference1_rcvd_date,
app_crs_enrol.reference2_rcvd_date, app_crs_enrol.transcript_rcvd_date,
app_crs_enrol.application_to_tutor_date, app_crs_enrol.condition1,
app_crs_enrol.condition2, app_crs_enrol.condition3,
app_crs_enrol.met_condition1, app_crs_enrol.met_condition2,
app_crs_enrol.met_condition3, year.year_descr, lkp_lookups_5.short_descr,
qualification.descr, app.notes, app_crs_enrol.fee_paid,
app_crs_enrol.fee_amount, app_crs_enrol.tuition_fee, crs.crs_sub_type,
crs_subject.relationship_lid, app_crs_enrol.year_id, org_1.org_type_lid,
org_1.org_name
FROM org AS org_1 RIGHT JOIN (org_org RIGHT JOIN (org RIGHT JOIN (subject
RIGHT JOIN (crs_subject RIGHT JOIN (crs_asp RIGHT JOIN ((((((((((app LEFT
JOIN app_address ON app.app_id = app_address.app_id) LEFT JOIN app_crs_enrol
ON app.app_id = app_crs_enrol.app_id) LEFT JOIN [year] ON
app_crs_enrol.year_id = year.year_id) LEFT JOIN lkp_lookups AS lkp_lookups_1
ON app_address.address_type_lid = lkp_lookups_1.code) LEFT JOIN crs ON
app_crs_enrol.crs_id = crs.crs_id) LEFT JOIN lkp_lookups AS lkp_lookups_2 ON
app_crs_enrol.mos_lid = lkp_lookups_2.code) LEFT JOIN lkp_lookups AS
lkp_lookups_3 ON app_crs_enrol.offer_lid = lkp_lookups_3.code) LEFT JOIN
lkp_lookups AS lkp_lookups_4 ON app_crs_enrol.app_decision_lid =
lkp_lookups_4.code) LEFT JOIN lkp_lookups AS lkp_lookups_5 ON
app.res_category_lid = lkp_lookups_5.code) LEFT JOIN qualification ON
crs.qual_id = qualification.qual_id) ON crs_asp.crs_id =
app_crs_enrol.crs_id) ON crs_subject.crs_id = crs.crs_id) ON subject.subj_id
= crs_subject.subj_id) ON org.org_id = subject.org_id) ON org_org.sub_org_id
= subject.org_id) ON org_1.org_id = org_org.org_id
WHERE (((crs.crs_sub_type)="Sos") AND
((crs_subject.relationship_lid)="003056") AND
((org_1.org_type_lid)="001414"));
I've made a query but it doesn't really work. When I run it, it always gets
to the end but never completely finishes? Hope that makes sense. I think it's
because of the amount of data that it is trying to show me or something. It
is sorting through hundreds of thousands of records and the trying to return
a few thousand or so.
I wonder if anyone had any suggestions as to how to make it work?
SQL below if it helps?
Jim Shady
SELECT DISTINCT app.app_id, app.forename, app.surname, crs.title,
lkp_lookups_2.short_descr, app_crs_enrol.start_date,
app_crs_enrol.offer_date, lkp_lookups_3.short_descr,
lkp_lookups_4.short_descr, app_crs_enrol.app_decision_date,
app_crs_enrol.application_rcvd_date, app_crs_enrol.reference1_rcvd_date,
app_crs_enrol.reference2_rcvd_date, app_crs_enrol.transcript_rcvd_date,
app_crs_enrol.application_to_tutor_date, app_crs_enrol.condition1,
app_crs_enrol.condition2, app_crs_enrol.condition3,
app_crs_enrol.met_condition1, app_crs_enrol.met_condition2,
app_crs_enrol.met_condition3, year.year_descr, lkp_lookups_5.short_descr,
qualification.descr, app.notes, app_crs_enrol.fee_paid,
app_crs_enrol.fee_amount, app_crs_enrol.tuition_fee, crs.crs_sub_type,
crs_subject.relationship_lid, app_crs_enrol.year_id, org_1.org_type_lid,
org_1.org_name
FROM org AS org_1 RIGHT JOIN (org_org RIGHT JOIN (org RIGHT JOIN (subject
RIGHT JOIN (crs_subject RIGHT JOIN (crs_asp RIGHT JOIN ((((((((((app LEFT
JOIN app_address ON app.app_id = app_address.app_id) LEFT JOIN app_crs_enrol
ON app.app_id = app_crs_enrol.app_id) LEFT JOIN [year] ON
app_crs_enrol.year_id = year.year_id) LEFT JOIN lkp_lookups AS lkp_lookups_1
ON app_address.address_type_lid = lkp_lookups_1.code) LEFT JOIN crs ON
app_crs_enrol.crs_id = crs.crs_id) LEFT JOIN lkp_lookups AS lkp_lookups_2 ON
app_crs_enrol.mos_lid = lkp_lookups_2.code) LEFT JOIN lkp_lookups AS
lkp_lookups_3 ON app_crs_enrol.offer_lid = lkp_lookups_3.code) LEFT JOIN
lkp_lookups AS lkp_lookups_4 ON app_crs_enrol.app_decision_lid =
lkp_lookups_4.code) LEFT JOIN lkp_lookups AS lkp_lookups_5 ON
app.res_category_lid = lkp_lookups_5.code) LEFT JOIN qualification ON
crs.qual_id = qualification.qual_id) ON crs_asp.crs_id =
app_crs_enrol.crs_id) ON crs_subject.crs_id = crs.crs_id) ON subject.subj_id
= crs_subject.subj_id) ON org.org_id = subject.org_id) ON org_org.sub_org_id
= subject.org_id) ON org_1.org_id = org_org.org_id
WHERE (((crs.crs_sub_type)="Sos") AND
((crs_subject.relationship_lid)="003056") AND
((org_1.org_type_lid)="001414"));