Is there any way to return distinct values with blank/null data from a table join. Best to explain with my example below.
Table "orders"
order_id | order_total
1        | 10
2        | 20
3        | 50
Table "order_items"
item_id | order_id | name     | qty_ordered | base_price | row_total
1       | 1        | Product  | 1           | 10         | 10
2       | 2        | Product  | 1           | 10         | 10
3       | 2        | Product2 | 1           | 10         | 10
4       | 3        | Product  | 2           | 10         | 20
5       | 3        | Product2 | 3           | 10         | 30
I'm trying to produce a result set that looks like this.
order_id | item_id | name     | qty_ordered | base_price | row_total | order_total
1        | 1       | Product  | 1           | 10         | 10        | 10
2        | 2       | Product  | 1           | 10         | 10        | 20
null     | 3       | Product2 | 1           | 10         | 10        | null
3        | 4       | Product  | 2           | 10         | 20        | 50
null     | 5       | Product2 | 3           | 10         | 30        | null
I only want the order_id and order_total once per order. I figure this is possible with some sort of join/distinct/sub query but alas nothing I've tried has worked so far.