Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations bkrike on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Joining queries 1

Status
Not open for further replies.

stinkybee

Programmer
May 15, 2001
218
GB
Hi,

I have two queries that I need to join to create one bigger query. The following work seperatley:

SELECT vouchers.*, special_days_vouchers.*, special_days.*
FROM (vouchers LEFT JOIN special_days_vouchers ON vouchers.ID = special_days_vouchers.ID)
LEFT JOIN special_days ON (special_days_vouchers.special_days_id = special_days.special_days_id)


SELECT vouchers.*, voucher_type.*
FROM (vouchers LEFT JOIN voucher_type_lookup ON vouchers.ID = voucher_type_lookup.ID)
LEFT JOIN voucher_type ON (voucher_type_lookup.voucher_type_id =voucher_type.voucher_type_id)


but I can't seem to find the right structure to combine them. Any help greatly appreciated.
 
Something like this ?
Code:
SELECT vouchers.*, special_days_vouchers.*, special_days.*,  voucher_type.*
FROM (((vouchers 
LEFT JOIN special_days_vouchers ON vouchers.ID = special_days_vouchers.ID)
LEFT JOIN special_days ON special_days_vouchers.special_days_id = special_days.special_days_id)
LEFT JOIN voucher_type_lookup ON vouchers.ID = voucher_type_lookup.ID) 
LEFT JOIN voucher_type ON voucher_type_lookup.voucher_type_id =voucher_type.voucher_type_id

Hope This Helps, PH.
FAQ219-2884
FAQ181-2886
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top