0

Show New Orders with Address If shipping and billing are different. I am stuck with this query. Can someone guide me a bit. Thanks enter image description here

  • Do you want to always show both addresses? Shahid shows how. Further note that if you store the same id into ShippingAddressId and BillingAddressId, you get the same address without wasting space. (But it could be tricky to update one without also changing the other.) – Rick James Jul 29 at 19:03
0
SELECT  t.TripId_PK, ls.name StartLocationName, le.name EndLocationName
FROM    trips t
JOIN    locations ls
ON      ls.LocationId_PK = t.StartLocationId_FK
JOIN    locations le
ON      le.LocationId_PK = t.EndLocationId_FK
| improve this answer | |

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.