Searching Multiple Models

Let’s say I have the following tables in my database (also converted to Models):

Table Name: items


item_id (Unique, auto increment)



Table Name: item_attributes


item_attribute_id (Unique, auto increment)

        item_id (Foreign Key to items.item_id)



I know each individual model has a search function, however I would like to be able to search for an item and have the system search return the item if it matches a field in the "item" table/model OR the "item_attributes" table/model for that item.

I’ve searched around a bit and haven’t really found a solution. Has anyone done this?

Or would I have to make a custom SQL query?

I am having the same problem. Can anyone help?

I think this is what you looking for.

Searching and sorting by related model in CGridView: