Add to-sql for compound select statements

There are no tests for this yet, and no front-end syntax