Einzelnen Beitrag anzeigen

Benutzerbild von Billa
Billa

Registriert seit: 11. Aug 2003
237 Beiträge
 
Delphi 10.2 Tokyo Professional
 
#3

AW: SQL-Statement: "zusammenpassende" Datensätze in EINER Zeile ausgeben

  Alt 21. Mai 2019, 16:55
Ich kenne MSSQL nicht. Würde aber in Firebird sowas machen:

select
A.prj, A.dat, A.tim,
B.tim, b.dur
from ttable A
left join ttable b on
(a.prj = b.prj) and (b.typ = 'E') and (B.tim > a.tim)
left join ttable c on
(c.prj = a.prj) and (c.typ = 'E') and (C.tim > a.tim) and (c.tim < b.tim)
where
a.typ = 'B' and
c.prj is null
order by
a.TIM

Es gibt vermutlich Effizienteres, aber da kannst Du schon mal ansetzen
Gruß Billa

Nur weil ich paranoid bin, heißt das nicht, daß die da draussen nicht hinter mir her sind....
  Mit Zitat antworten Zitat