SQL 需要更正查询

SQL Query correction required

SELECT TOP (2)
    DATEPART(HOUR,t.callerDateTime) as Hour
    ,count(cli) as Count
FROM ivrtimeout t
where convert(date,t.callerDateTime) = convert(date,getdate(),103)
group by DATEPART(HOUR,t.callerDateTime) 
order by DATEPART(HOUR,t.callerDateTime) desc

以上查询在 Microsoft SQL 服务器的情况下工作正常,但在 xamp 服务器 maria-db 中使用时出现错误。

谁能指正一下吗?

试试这个:

select
  extract(HOUR from callerDateTime) as Hour,
  count(cli) as Count
from ivrtimeout
where callerDateTime >= timestamp(current_date)
group by 1
order by 1 desc
limit 2