Fix generation of incorrect SQL syntax (n1 AS n2 AS n3)

Fixes FlipPHPBug.adl problem. I think this is what is intended here, but it should be checked. (It is not entirely clear to me why the only the source may be aliased)

@stefjoosten Everything works well on the sentinel, so if this code is what we want here, you can merge the pull request.