我希望将此 Sql 命令转换为 yii cactivedataprovider 格式,以便我可以使用此标准提供 dataprovider。
SELECT *
FROM (
SELECT (
CASE WHEN product_name LIKE '%nokia%'
THEN 1
ELSE 0
END +
CASE WHEN product_name LIKE '%lumia%'
THEN 1
ELSE 0
END +
CASE WHEN product_name LIKE '%800%'
THEN 1
ELSE 0
END
) AS numMatches, product_name
FROM Production
) AS t
WHERE numMatches >0
ORDER BY numMatches DESC