added support for subqueries in from clause