The get method returns an Array of Structs by default. Both columns and options are optional.
public any functionget( any columns, struct options = {} )
Retrieving A Single Row / Column From A Table
If you just need to retrieve a single row from the database table, you may use the first method. This method will return a single record (a Struct by default). If no row is found an empty Struct will be returned by default.
//qbvar getResults =query.from('users').first();writeDump(getResults);//sqlselect * from users limit(1)
public any functionfirst( struct options = {} )
If you don't even need an entire row, you may extract a single value from each record using the values method. This method will return the value of the column directly:
public any functionvalue( required string column, struct options = {} );
Options parameter: Retrieving results from alternative datasources
In application.cfc you can specify your default datasource which will be used by qb. If you want to retrieve data from other datasources you can specify this in all retrieval functions by using the extra options parameter such as: