Linq is one heck (pun intended) of a mess internally sometimes. A 'join' is always the 'right' side. Your Max() has as source the groupby. Say the groupby has alias LPLA_7. The aggregate is placed inside the groupby query (otherwise it doesn't work, a difference between linq and SQL) so it has to refer to the SOURCE of the groupby expression. But that's a join. Which side to refer to? Well... that's always the right side. It has been a while since I worked on joins and looking up the design docs where I had noted some remarks about this indeed showed this. . Adding that 'special case check' to the preprocessor of the tree makes the query generate the proper SQL. (It dies inside the projector where a NULL date can't be handled, working on that).
It's this kind of special case programming which makes writing a linq provider... 'a challenge'. Ironically, the linq to sql code is packed with this kind of special case tests as well. If you use reflector on some methods you'll see it has some very awkward if expressions which are very long (and test some obscure combinations of boolean expressions which apparently have a relation but that's unclear). Oh well....
The NULL date should be handled in the projector (2 customers in northwind don't have orders, so the aggregate returns NULL for last order date. However the projector gets confused in this particular case. Will check that out as well.
What's especially crap about Linq's design (if I may say so) is that it tries to work with sequences instead of sets, but that's only because linq to objects works that way (as objects in memory have an order, sets don't). So instead of designing Linq as a language working with sets, which COULD work with sequences (which have an order), which would have made things much easier for everyone, they instead design it around sequences and the providers which have to work with sets (supertype of sequence ) have to jump through hoops to make the functionality work. Which of course doesn't work out that well...
(edit)Ok fixed that.
Btw, your query has a bug too: if the customer has no orders, TotalOrders is 1. This is because you do a left join so Customer left join Orders always has a row: the customer. This is the result in linq to sql and our code.
The issue with the alias and the null issue are fixed in the next build.