0
  I have a table MNO like this:-



 key    open  mode  close     time
   1    112    O             10:15pm
   1           C     200     11:50pm

クエリの出力でこれを取得したい:-

key  open   close   difference  open_time   close_time
1    112     200      88         10:15pm      11:50pm
4

1 に答える 1

2
select
 o.key, o.open, c.close, 
 c.close - o.open as difference,
 o.time as open_time,
 c.time as close_time
from 
  mno o
  mno c
where
  o.key = c.key
and o.mode='O'
and c.mode='C'
;
于 2012-08-10T09:35:22.200 に答える