我正在运行以下查询,但似乎无法让datediff()
过滤器工作。查询成功执行,但即使我将其更改datediff()
为不同的值,我仍然得到相同的结果。
SELECT project_id
, google_rank
, COALESCE(
( SELECT google_rank
FROM eig_ranking mi
WHERE mi.project_id = m.project_id
ORDER BY project_id limit 1
)
, 0) - google_rank AS movement
, keyword
, domain
FROM eig_ranking m
WHERE (DATEDIFF(rank_date, NOW())) / 7 <= 12
AND google_rank != 0
ORDER BY movement DESC