Initial support for relational query flattening

Turns SelectMany into a single SQL query.

Can go in once SQLite Northwind is fixed.