Question About Mergewith And Union Methods In Cdbcriteria

Hi everyone,

I have a very complex query in the search method of my model.

This query is based on a Sql union of two different queries that extract rows from the same table.

I’m using Yii 1.1.14, so I think I cannot use union method in CDbCriteria. I’ve tried the mergeWith, but

$criteria->mergeWith($criteria2, true) or

$criteria->mergeWith($criteria2, false)

I think I’m doing the intersection. Am I right? How can I solve this?

The only solution in my case is to write the Sql query using criteria->sql(’…’) with params?

Bye,

Thanks

Why don’t you use a View directly on Db ?