这条 SQL 语句如何写?谢谢!

peachblossom 2002-07-15 09:55:47
发布者 text
发布时间 date
结束时间 date

我现在想搜索今天是是发布时间和结束时间之间的所有记录,怎么写?
...全文
26 10 打赏 收藏 转发到动态 举报
写回复
用AI写文章
10 条回复
切换为时间正序
请发表友善的回复…
发表回复
流星尔 2002-07-17
  • 打赏
  • 举报
回复
select * from table where getdate() between 发布时间 and 结束时间

流星尔 2002-07-17
  • 打赏
  • 举报
回复
select * from table where getdate() between 发布时间 and 结束时间

erickleung 2002-07-17
  • 打赏
  • 举报
回复
Interbase:
select 发布者, 发布时间, 结束时间 from Mytable
where Extract(发布时间 as 'date') = Extract('now' as 'date');
and Extract(结束时间 as 'date') = Extract('now' as 'date');
petkoala 2002-07-17
  • 打赏
  • 举报
回复
select * from table where getdate() between 发布时间 and 结束时间
firetoucher 2002-07-16
  • 打赏
  • 举报
回复
up
zhoubf725 2002-07-16
  • 打赏
  • 举报
回复
不知道用的是什么数据库(好像这个论坛的多数帖子都不说明自己用什么数据库)

oracle:

select * from tab
where trunc(date_begin)=to_date('020716','yymmdd')
and trunc(date_end)=to_date('020716','yymmdd')

如果考虑到效率问题,在date_begin,date_end上都建上基于trunc()的index
warning 2002-07-15
  • 打赏
  • 举报
回复
sql server:
select * from table where getdate() between 发布时间 and 结束时间
zhou_hn 2002-07-15
  • 打赏
  • 举报
回复
warning(爱就爱了)


sql server:
select * from table where getdate() between 发布时间 and 结束时间


:)

yihan_51 2002-07-15
  • 打赏
  • 举报
回复
use 數據庫
select * from 表單 where date between 發布時間 and 結束時間
Symanteck 2002-07-15
  • 打赏
  • 举报
回复
select * from table where date between 发布时间 and 结束时间

34,594

社区成员

发帖
与我相关
我的任务
社区描述
MS-SQL Server相关内容讨论专区
社区管理员
  • 基础类社区
  • 二月十六
  • 卖水果的net
加入社区
  • 近7日
  • 近30日
  • 至今
社区公告
暂无公告

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