sql 高手请进(有些难度)

wlvcd 2003-09-30 09:46:42
大侠们:
请看这个表
table p
period_type from_date end_date
weekdays 1 3
weekdays 5 5
weekend 6 7
要实现:
period_type w_date
weekdays 1
weekdays 2
weekdays 3
weekdays 5
weekend 6
weeeend 7
请问大虾能否用sql 来实现,兄弟多谢了!


...全文
50 4 打赏 收藏 转发到动态 举报
写回复
用AI写文章
4 条回复
切换为时间正序
请发表友善的回复…
发表回复
hdkkk 2003-09-30
  • 打赏
  • 举报
回复
楼上的是对的。厉害!佩服
Lastdrop 2003-09-30
  • 打赏
  • 举报
回复
sorry,应该是下面的SQL

select p.period_type, a.no w_date
from p, (select rownum no from all_objects where rownum < 8) a
where a.no between p.from_date and p.end_date
order by p.period_type, a.no
Lastdrop 2003-09-30
  • 打赏
  • 举报
回复
select period_type, from
( select decode(period_type,'weekdays',0,1) type,period_type,from_date w_date
from p
uion all
select decode(period_type,'weekdays',0,1) type,period_type,end_date
from p
) a
order by a.type
tsj68 2003-09-30
  • 打赏
  • 举报
回复
佩服楼上的妙句,收藏先.

3,491

社区成员

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

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