-
Notifications
You must be signed in to change notification settings - Fork 0
SQL Like: Column Select
joelwatson edited this page May 19, 2015
·
1 revision
CriteriaBuilder allows you produce result sets that limit the data of the current store by providing a SQL-like list of columns.
Each "column" you want to include can also be "aliased", so if you want to transform the name of the property in the model to something different in the result, simply add an alias like so:
SELECT {propertyName} {aliasName} SELECT address addy
If a property you want to include in the result set is from an association of the store's model, you should include the join alias when defining the column inclusion:
SELECT {jonAlias}.{propertyName} {aliasName} SELECT a.address addy
NOTE: When using a "select" statement, only "store" and "collection" return results will be affected.
var cb = new CriteriaBuilder.Builder({ store: mystore }); var sql = 'select a.address addy, orderId, orderNumber num'; // run cb.query({sql:sql});