hello. please tell me is there any way to use Model relations to build same query "SELECT c.* FROM Category AS c LEFT JOIN Video AS v ON (v.cat_id=c.id) WHERE c.enable = 1 GROUP BY v.cat_id HAVING COUNT(v.id)>0";
category: public function initialize() { $this->hasMany('id', 'Video', 'cat_id'); } video: public function initialize() { $this->belongsTo("cat_id", "Category", "id"); }