Created
September 29, 2023 15:06
-
-
Save tylergets/acbacd2999b6c9b59de5d1f66802fa95 to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
SELECT | |
"Order".id, | |
C.name, | |
A.line1, | |
A.line2, | |
A.city, | |
A.zip, | |
S.name, | |
H.name as "hatchery_name", | |
HA.line1 as "hatchery_line1", | |
HA.line2 as "hatchery_line2", | |
HA.city as "hatchery_city", | |
HS.name as "hatchery_state", | |
HA.zip as "hatchery_zip" | |
FROM "Order" | |
LEFT JOIN "Customer" C on "Order"."customerId" = C.id | |
LEFT JOIN "Hatchery" H on C."hatcheryId" = H.id | |
LEFT JOIN "Address" HA on H."addressId" = HA.id | |
LEFT JOIN "Address" A on "Order"."shippingAddressId" = A.id | |
LEFT JOIN "State" S on A."stateId" = S.id | |
LEFT JOIN "State" HS on HA."stateId" = HS.id |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment