Below are two samples on how to create a query with ActiveRecord and ICriterion. Example 1: Select all contacts from Texas The Controller’s syntax would be this: Example 2: SQL style query The next part is where all the magic happens. The “SELECT” part is done for us automatically, so we simply add our WHERE [...]