sql 语句

Juedaifanghua 2011-04-26 05:46:23
从某张表里取一条数据 条件是它的创建时间最早 条件怎么写
...全文
109 11 打赏 收藏 转发到动态 举报
写回复
用AI写文章
11 条回复
切换为时间正序
请发表友善的回复…
发表回复
yinan9 2011-04-28
  • 打赏
  • 举报
回复
[Quote=引用 3 楼 hanks_gao 的回复:]
SQL code

select * from table
where createtime=(
select min(createtime)
from table where colName = 'colValue'
) and colName = 'colValue'
[/Quote]对了
yejihui9527 2011-04-28
  • 打赏
  • 举报
回复
createtime 有吗
select * from table_name where rowid = (select min(rowid) from table_name)
rowid 不知道行不行
crmcrm4 2011-04-28
  • 打赏
  • 举报
回复
select * from table_name where createtime in (select min(createtime) from table_name)


搭火箭看日出 2011-04-27
  • 打赏
  • 举报
回复
也是这么想的
wubing1111 2011-04-27
  • 打赏
  • 举报
回复
[Quote=引用 1 楼 xumeng929 的回复:]
select * from table where createtime=(select min(createtime) from table)
[/Quote]
楼上的正确的
苹果城的肥瓜 2011-04-27
  • 打赏
  • 举报
回复
select *
from tb t1
where not exists(select 1 from tb t2 where t1.ctime>t2.ctime)
lixinbill 2011-04-27
  • 打赏
  • 举报
回复

select * from table where createtime=(select min(createtime) from table)
加油馒头 2011-04-26
  • 打赏
  • 举报
回复
得出最小时间即可
hanks_gao 2011-04-26
  • 打赏
  • 举报
回复

select * from table
where createtime=(
select min(createtime)
from table where colName = 'colValue'
) and colName = 'colValue'
  • 打赏
  • 举报
回复
select * 
from tb t1
where not exists(select 1 from tb t2 where t1.ctime>t2.ctime)
xumeng929 2011-04-26
  • 打赏
  • 举报
回复
select * from table where createtime=(select min(createtime) from table)

17,086

社区成员

发帖
与我相关
我的任务
社区描述
Oracle开发相关技术讨论
社区管理员
  • 开发
  • Lucifer三思而后行
  • 卖水果的net
加入社区
  • 近7日
  • 近30日
  • 至今
社区公告
暂无公告

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