I am trying to create a SQL view that shows the order details from the SOPOrderReturn table, the email address on the order (if not using invoice address) from the SOPDocDelAddress table, and the main email address for the account (for use when there is no email on the order). So far I've managed to get it kind of working but it's showing the same lines multiple times.
Can anyone suggest the best way to do this?