尝试创建一个mysql查询,在其中计算过滤器数据库的名称。成功,从某个时期获得名字是主要目标。
$query = query("
SELECT count(CASE WHEN filter='冬越しする(現在地検索)' THEN 1 END) as filter,
count(CASE WHEN filter='開花期で選ぶ' THEN 1 END) as filter2,
count(CASE WHEN filter='日当たりで選ぶ' THEN 1 END) as filter3,
count(CASE WHEN filter='株幅で選ぶ' THEN 1 END) as filter4,
count(CASE WHEN filter='背丈で選ぶ' THEN 1 END) as filter5,
count(CASE WHEN filter='機能、タイプで選ぶ' THEN 1 END) as filter6,
count(CASE WHEN filter='ビギナーおすすめ' THEN 1 END) as filter7 FROM
filter_clicked WHERE filter_date < DATEADD(day, -30, GETDATE())");
答案 0 :(得分:2)
您必须使用now()-now()-间隔30天-您使用的是SQL Server函数
$query = query("
SELECT count(CASE WHEN filter='冬越しする(現在地検索)' THEN 1 END) as filter,
count(CASE WHEN filter='開花期で選ぶ' THEN 1 END) as filter2,
count(CASE WHEN filter='日当たりで選ぶ' THEN 1 END) as filter3,
count(CASE WHEN filter='株幅で選ぶ' THEN 1 END) as filter4,
count(CASE WHEN filter='背丈で選ぶ' THEN 1 END) as filter5,
count(CASE WHEN filter='機能、タイプで選ぶ' THEN 1 END) as filter6,
count(CASE WHEN filter='ビギナーおすすめ' THEN 1 END) as filter7 FROM
filter_clicked WHERE filter_date < date(now())-interval 30 day")