我必须根据可以为空的值选择相应的列来加入。详细地:
SELECT shoporders.orderid,
shopaddresses.companyname,
shopaddresses.firstname,
shopaddresses.lastname,
shopaddresses.address1,
FROM shoporders
INNER JOIN shopaddresses
ON shoporders.InvoiceAddressId = shopaddresses.addressid
where orderid = 110
order by shoporders.createddate desc
如果 shoporders.InvoiceAddressId 为空,那么我必须使用 shoporders.DeliveryAddressId
有什么线索吗?
提前致谢