Some things given abbreviated treatment in the chapter:
Example of db_merge() in action in actions_save().
Caution The groupBy method for db_select() requires that you include the field you are grouping on in the fields portion of the query. Leaving off
->fields('users', array('status'))
when grouping by status will cause an error.