我想根据最近日期(最近日期)从DB中获取记录。 我已经写一个查询向下低于该不工作,并显示错误:查询获取最近日期的记录
11时55分05秒中选择名字,姓氏从mb_orderhistory其中 EVENTTYPE =“PROPOSED_ITEM_EDIT”和订单ID = 80822和 MAX(updatedDate) GROUP BY orderId错误代码:1111.无效使用 组函数0.015秒
这是我写的查询。
select firstName,lastName from mb_orderhistory where eventType="PROPOSED_ITEM_EDIT" and
orderId=80822 and MAX(updatedDate) GROUP BY orderId;
你用哪个数据类型为“updatedDate”? @Akash –
数据类型是'date' – Akash
你可以尝试使用'ORDER BY'和'LIMIT'。另一种选择是在'SELECT'子句中用'MAX'编写子查询。 – mm759