1

我的数据库表包含以下详细信息

Event Name  Event Date                  Event Status
Event 1     2013-11-11 06:10:13.24      Active
Event 2     2014-02-04 06:10:13.24      Active
Event 3     2013-11-01 06:10:13.24      Active
Event 4     2013-02-04 06:10:13.24      InActive

如何根据活动日期获取下一个即将到来的活动活动。是否有任何查询将数据库日期与当前日期进行比较并返回最近即将发生的事件。在上述情况下,SQL 查询应该只返回“事件 3”

我想知道如何为日期设置 SQL 条件。我尝试使用 Now() 函数,但它给了我以下错误

" No authorized routine named "NOW" of type "FUNCTION" having compatible arguments was    found.. SQLCODE=-440 " 
4

1 回答 1

2
select *
from your_table
where `event date` > CURRENT_TIMESTAMP
and `event status` = 'Active'
order by `event date` asc
FETCH FIRST 1 ROWS ONLY
于 2013-10-31T16:44:00.623 回答