dedlfix: Oracle 10g, Select, Order By, gib mir die drittletzte Zeile

Beitrag lesen

echo $begrüßung;

SELECT id, starttime FROM
  (
    SELECT id, starttime FROM
      (
        SELECT id, starttime FROM tabelle WHERE name='bla' ORDER BY starttime DESC
      )
    WHERE ROWNUM < 4 ORDER BY starttime ASC
  )
WHERE ROWNUM < 2
Wie krieg ich das ohne das dreifach-Select-Monster hin?

Geht denn

SELECT * FROM
    (
      SELECT id, starttime FROM tabelle WHERE name='bla' ORDER BY starttime DESC
    )
  WHERE ROWNUM = 3

nicht? Wenn ja, dann vielleicht so:

SELECT id, starttime FROM
    (
      SELECT ROWNUM as line, id, starttime FROM tabelle WHERE name='bla' ORDER BY starttime DESC
    )
  WHERE line = 3

echo "$verabschiedung $name";