Hi there, I've got a query that I've made but I've got a problem with -
Is this the 'neatest' way of writing this? I'm this could be written a lot better, I've heard you can 'loop through recordset' using more queries - would this be a good thing to do? And if so can someone point me in the right direction? This query must use up a lot of memory due to it being spread acrosss 8 tables including a sub-query with 3 tables.
Note - I'm using a slave database with read-only access so changing structure/creating tables etc. is impossible!
Many thanks for any help. Very much appreciated.
Select travel_booking.reference As REF,
travel_group.name As `Group Name`,
site_user.firstname As `First Name`,
site_user.lastname As `Last Name`,
site_user.gender,
travel_package.start_date As `Start Date`,
travel_booking_option.name As `Option Name`,
travel_booking_option.text_box_text As `Free Text`,
travel_booking_option.select_box_option As `Select Text`,
travel_booking_option.option_price As `Option Price`,
content.name As `Option Type`
From travel_booking Inner Join
travel_booking_option On travel_booking_option.travel_bookingid =
travel_booking.travel_bookingid Inner Join
travel_group On travel_group.travel_groupid = travel_booking.travel_groupid
Inner Join
site_user On site_user.site_userid = travel_booking.site_userid Inner Join
travel_option_group On travel_option_group.travel_option_groupid =
travel_booking_option.travel_option_groupid Inner Join
content On travel_option_group.travel_option_type_content_realid =
content.content_realid Inner Join
travel_package On travel_package.content_realid =
travel_booking.travel_packageid
Where travel_booking_option.fee = 0 And travel_booking_option.refund = 0 And
travel_booking_option.cancel = 0 And travel_booking.cancel = 0 And
travel_package.live = 1 And content.live = 1
Group By travel_booking.reference,
travel_group.name,
site_user.firstname,
site_user.lastname,
site_user.gender,
travel_package.start_date,
travel_booking_option.name,
travel_booking_option.text_box_text,
travel_booking_option.select_box_option,
travel_booking_option.option_price,
content.name