取出一个表的最小值 同时 取出 最小值的日期 是怎样写 sql

renzaijiang 2010-04-18 11:45:29
SELECT min(price) as price , date from a_price

取出一个表的最小值 同时 取出 最小值的日期 是怎样写 sql
上面好像不对
...全文
145 4 打赏 收藏 转发到动态 举报
写回复
用AI写文章
4 条回复
切换为时间正序
请发表友善的回复…
发表回复
ACMAIN_CHM 2010-04-18
  • 打赏
  • 举报
回复
select price,`date` from  a_price order by price limit 1


请勿使用保留字做为字段名。 date
百年树人 2010-04-18
  • 打赏
  • 举报
回复
select price,`date`
from a_price t
where not exists(select 1 from a_price where price<t.price)
feixianxxx 2010-04-18
  • 打赏
  • 举报
回复
整表最小可以使用
select price,`date` from a_price order by price limit 1
feixianxxx 2010-04-18
  • 打赏
  • 举报
回复
[Quote=引用 1 楼 josy 的回复:]
SQL code
select price,`date`
from a_price t
where not exists(select 1 from a_price where price<t.price)
[/Quote]
树哥原来在这。。

56,679

社区成员

发帖
与我相关
我的任务
社区描述
MySQL相关内容讨论专区
社区管理员
  • MySQL
加入社区
  • 近7日
  • 近30日
  • 至今
社区公告
暂无公告

试试用AI创作助手写篇文章吧