现在有个表在数据库中:
Weekday Fromtime Totime
MW 1200 1300
需要通过查询语句得到如下结果:
Weekday Fromtime Totime
Monday 1200 1300
Wednesday 1200 1300
请问各位该如何写查询语句呢?
Weekday Fromtime Totime
MW 1200 1300
需要通过查询语句得到如下结果:
Weekday Fromtime Totime
Monday 1200 1300
Wednesday 1200 1300
请问各位该如何写查询语句呢?
SQL>
SQL> with m as (
2 select 'WM' a, 1200 b, 1300 c from dual
3 )
4 select substr(A,rownum,1) a,b,c from m
5 connect by rownum <= length(a);
A B C
-- ---------- ----------
W 1200 1300
M 1200 1300SQL>
补充
with m as (
select 'WM' a, 1200 b, 1300 c from dual
)
select case substr(A,rownum,1) when 'W' then 'Wednesday' when 'M' then 'Monday' end a,
b,
c
from m
connect by rownum <= length(a);