如何将此查询转换为Yii活动记录?
SELECT a.USERID, a.ADID, a.PAGEVIEW,a.EXPIRYDATE,a.ADTITLE,a.ADDESC
from CKAD a INNER JOIN
(
SELECT b.USERID, max(b.PAGEVIEW) as PAGEVIEW
FROM CKAD b WHERE b.DISPPUBLISHDATE >= current_date - 3
AND b.EXPIRYDATE >= current_date and b.STATUS = 1 AND b.USERID IS NOT NULL
GROUP BY b.USERID
) b
ON (a.USERID = b.USERID and a.PAGEVIEW = b.PAGEVIEW)
order by a.PAGEVIEW DESC";