>...
>This returns less than 5444 records, because some items have not been shipped. I need the final result to still have 5444 records. Also, this second query runs pretty slow (I think it joins everything before applying the where condition).
>
>I tried creating a view that joins pastInvoices and pastInvoiceLines, so I could join with that view in my second query, but opening the view takes a lifetime.
Try dividing the query into pieces: select perhaps two tables first, join the result with a third table, etc. This can sometimes speed things up dramatically.
Difference in opinions hath cost many millions of lives: for instance, whether flesh be bread, or bread be flesh; whether whistling be a vice or a virtue; whether it be better to kiss a post, or throw it into the fire... (from Gulliver's Travels)