Hi. There are 2 common ways 1. Create global temporary table Do INSERT INTO T(DSTART, DEND) SELECT … and then do simple join with this table 2. Use derived table e.g. SELECT DATENLOGGING.* … FROM (SELECT D.DSTART, D.DEND FROM TABLED) X LEFT JOIN DATENLOGGING ON DATENLOGGING.DATUMZEIT>=X. DSTART AND DATENLOGGING.DATUMZEIT<=X.DEND WHERE DATENLOGGING.KEY IS NOT NULL /* do hidden inner join by providing some not nullable field check */
Regards, Karol Bieniaszewski