Registriert seit: 26. Aug 2004
Ort: Nebel auf Amrum
3.154 Beiträge
Delphi 7 Enterprise
|
Re: Query Reporter-Report
30. Nov 2008, 00:29
SQL-Code:
SELECT SUBSTR(telegramm, 14, 4) AS bez,
zeitstempel,
zeitstempel - (SELECT MIN(zeitstempel)
FROM tabelle
WHERE SUBSTR(telegramm, 12, 2) = 'RB'
AND SUBSTR(telegramm, 18, 2) = 'AU'
AND SUBSTR(telegramm, 8, 4) = SUBSTR(t.telegramm, 8, 4)
AND zeitstempel > t.zeitstempel) AS dauer
FROM tabelle t
WHERE SUBSTR(telegramm, 12, 2) = 'RB'
AND SUBSTR(telegramm, 18, 3) = '00S'
oder so...
SQL-Code:
SELECT SUBSTR(a.telegramm, 14, 4) AS bez,
a.zeitstempel,
a.zeitstempel - MIN(b.zeitstempel) AS dauer
FROM tabelle a
LEFT JOIN tabelle b
ON SUBSTR(b.telegramm, 12, 2) = 'RB'
AND SUBSTR(b.telegramm, 18, 2) = 'AU'
AND SUBSTR(a.telegramm, 8, 4) = SUBSTR(b.telegramm, 8, 4)
AND a.zeitstempel < b.zeitstempel
WHERE SUBSTR(a.telegramm, 12, 2) = 'RB'
AND SUBSTR(a.telegramm, 18, 3) = '00S'
GROUP BY SUBSTR(a.telegramm, 14, 4), a.zeitstempel
|
|
Zitat
|