49 lines
1.4 KiB
SQL
49 lines
1.4 KiB
SQL
SELECT c.id cmrFk,
|
|
c.ticketFk,
|
|
c.truckPlate,
|
|
c.observations,
|
|
c.senderInstruccions,
|
|
c.paymentInstruccions,
|
|
c.specialAgreements,
|
|
c.created,
|
|
c.packagesList,
|
|
c.merchandiseDetail,
|
|
c.ead,
|
|
s.name carrierName,
|
|
s.street carrierStreet,
|
|
s.postCode carrierPostCode,
|
|
s.city carrierCity,
|
|
cou.country carrierCountry,
|
|
s2.name senderName,
|
|
s2.street senderStreet,
|
|
s2.postCode senderPostCode,
|
|
s2.city senderCity,
|
|
cou2.country senderCountry,
|
|
a.street deliveryStreet,
|
|
a.id deliveryAddressFk,
|
|
a.postalCode deliveryPostalCode,
|
|
a.city deliveryCity,
|
|
a.nickname deliveryName,
|
|
a.phone deliveryPhone,
|
|
a.mobile deliveryMobile,
|
|
cou3.country deliveryCountry,
|
|
cl.phone clientPhone,
|
|
a2.street loadStreet,
|
|
a2.postalCode loadPostalCode,
|
|
a2.city loadCity,
|
|
cou4.country loadCountry
|
|
FROM cmr c
|
|
LEFT JOIN supplier s ON s.id = c.supplierFk
|
|
LEFT JOIN country cou ON cou.id = s.countryFk
|
|
LEFT JOIN company co ON co.id = c.companyFk
|
|
LEFT JOIN supplierAccount sa ON sa.id = co.supplierAccountFk
|
|
LEFT JOIN supplier s2 ON s2.id = sa.supplierFk
|
|
LEFT JOIN country cou2 ON cou2.id = s2.countryFk
|
|
LEFT JOIN `address` a ON a.id = c.addressToFk
|
|
LEFT JOIN province p ON p.id = a.provinceFk
|
|
LEFT JOIN country cou3 ON cou3.id = p.countryFk
|
|
LEFT JOIN client cl ON cl.id = a.clientFk
|
|
LEFT JOIN `address` a2 ON a2.id = c.addressFromFk
|
|
LEFT JOIN province p2 ON p2.id = a2.provinceFk
|
|
LEFT JOIN country cou4 ON cou4.id = p2.countryFk
|
|
WHERE c.id = ? |