我想得到一個計數,按天分組。下面的SELECT正常工作:爲什麼在MySQL中每個有效的SELECT都不是有效的VIEW?
SELECT COUNT(time_end),
time_end
FROM main
GROUP BY DAY(time_end)
我複製/粘貼到這一點的phpmyadmin的視圖創建的形式,出現此錯誤:
"#1064 - You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near 'count(time_end)) AS SELECT count(time_end) , time_end FROM main GROUP BY d' at line 4"
這裏是從的phpmyadmin的形式生成完整的SQL:
CREATE ALGORITHM = UNDEFINED VIEW `count by day` (
time_end,
count(time_end)
) AS SELECT COUNT(time_end),
time_end
FROM main
GROUP BY DAY(time_end)
怎麼了?爲什麼有效的SELECT不會自動成爲有效的VIEW創建?謝謝。