cfquery
and COUNT(id) AS x
type queries when you wanted to get aggregate values, right?authors
table, simply do this:profiles
and also setup a hasOne
/ belongsTo
association between the author
and profile
models.include
argument to reference other tables.countries
table as well?hasMany
association, CFWheels will be smart enough to add the DISTINCT
keyword to the SQL. This makes sure that you're only counting unique rows.id
is the primary key of the authors
table and the correct associations have been setup):property
argument.distinct=true
to this function if you want to include only each unique instance of a value in the average calculation.property, where, include
, and distinct
).group
argument. Let's build on the example with getting the average salary for a department above, but this time, let's get the average for all departments instead.cfquery
result set back, as opposed to a single value.group
argument is currently only supported on SQL Server and MySQL databases.