gaengsterbruth
Mitglied
Hallo Zusammen!
Ich möchte gern die untenstehenden Tabellen miteinander Verknüpfen:
order
uid
systemintegrator_id
system_contact_id
licenceholder_id
holder_contact_id
company
uid
company
surname
address
plz
city
contact
uid
gender
surname
Die Felder systemintegrator_id und licenceholder_id sollen beide mit der company.uid verknüpft werden.
Während die Felder system_contact_id und holder_contact_id beide mit der contact.uid verknüpft werden sollen.
Mein Ansatz hat so ausgesehen:
select
t1.uid AS id,
t2.company AS kundenname,
t3.surname AS kundenkontakt,
t2.address AS kundenadresse,
t2.plz AS kundenplz,
t2.city AS kundenort,
t2.company AS firma,
t3.surname AS kontakt,
t2.address AS adresse,
t2.plz AS plz,
t2.city AS ort,
FROM
typomst.tx_mstshop_order t1
LEFT JOIN typomst.tx_mstshop_company t2 ON ((t1.systemintegrator_id = t2.uid) AND ( t1.system_contact_id = t2.uid))
LEFT JOIN typomst.tx_mstshop_company t3 ON((t1.licenceholder_id = t3.uid) AND (holder_contact_id = t3.uid))
Wie schreibe ich dieses Query richtig ?
Gruess
Ruth
Ich möchte gern die untenstehenden Tabellen miteinander Verknüpfen:
order
uid
systemintegrator_id
system_contact_id
licenceholder_id
holder_contact_id
company
uid
company
surname
address
plz
city
contact
uid
gender
surname
Die Felder systemintegrator_id und licenceholder_id sollen beide mit der company.uid verknüpft werden.
Während die Felder system_contact_id und holder_contact_id beide mit der contact.uid verknüpft werden sollen.
Mein Ansatz hat so ausgesehen:
select
t1.uid AS id,
t2.company AS kundenname,
t3.surname AS kundenkontakt,
t2.address AS kundenadresse,
t2.plz AS kundenplz,
t2.city AS kundenort,
t2.company AS firma,
t3.surname AS kontakt,
t2.address AS adresse,
t2.plz AS plz,
t2.city AS ort,
FROM
typomst.tx_mstshop_order t1
LEFT JOIN typomst.tx_mstshop_company t2 ON ((t1.systemintegrator_id = t2.uid) AND ( t1.system_contact_id = t2.uid))
LEFT JOIN typomst.tx_mstshop_company t3 ON((t1.licenceholder_id = t3.uid) AND (holder_contact_id = t3.uid))
Wie schreibe ich dieses Query richtig ?
Gruess
Ruth