N
N
Nicholas2014-07-04 12:26:42
Yii
Nicholas, 2014-07-04 12:26:42

How to implement search on 3 fields of YII ActiveRecords like CONCAT_WS(' ', lname,fname,mname) LIKE '%Peter%'?

Actually, subject, how to make such a condition using yii AR?

Answer the question

In order to leave comments, you need to log in

2 answer(s)
N
Nikolai, 2014-07-04
Sumrak @NikolasSumrak

The solution turned out to be simple:

$criteria->compare('CONCAT_WS(\' \', t.lname, t.fname, t.mname)', $this->name, true);

D
Dima Barsukov, 2014-07-04
@mrsombre

Use CDbCriteria->addCondition

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question