Added raw option to include raw criteria into SELECT statement to allow subqueries and other advanced functions