Here is an example of joint tables using alias.
1 2 3 4 5 6 7 8 9 10 11 |
$obj = $this->asObject() ->selectCount('count(w.id) as cnt') ->from('work as w') ->join('author as a', 'w.author_id=a.id', 'LEFT') ->join('category as c', 'w.category_id=c.id', 'LEFT') ->like('w.name', $search) ->orLike('w.brief', $search) ->orLike('a.name', $search) ->orLike('c.name', $search) ->first(); return $obj->cnt; |