问个sql语句

liuys00 2007-02-02 10:31:09
oracle数据库的两个表t1和t2,都有content(VARCHAR2(20)),和time(DATE)字段。
我希望查询两个表在同一个时间段内的所有content字段
把查询结果按照time字段给排序。
sql语句应该怎么写?
...全文
134 4 打赏 收藏 转发到动态 举报
写回复
用AI写文章
4 条回复
切换为时间正序
请发表友善的回复…
发表回复
liuys00 2007-02-02
  • 打赏
  • 举报
回复
谢谢两位!
yz1199 2007-02-02
  • 打赏
  • 举报
回复
收回刚才的话,意思理解错了。。。。
yz1199 2007-02-02
  • 打赏
  • 举报
回复
select t1.content as col1,t2.content as col2 from t1,t2 where t1.time=t2.time order by t1.time同一时间的
如果是同一时间段的,没有关联字段的话,会多出记录
magicsnake 2007-02-02
  • 打赏
  • 举报
回复
select content,time
from (
select content,time from t1 where time >= 'begin_date' and time < 'end_date'
union all
select content,time from t2 where time >= 'begin_date' and time < 'end_date'
) m
order by time

111,125

社区成员

发帖
与我相关
我的任务
社区描述
.NET技术 C#
社区管理员
  • C#
  • Creator Browser
  • by_封爱
加入社区
  • 近7日
  • 近30日
  • 至今
社区公告

让您成为最强悍的C#开发者

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