Thema: Delphi SQL-Abfrage optimieren

Einzelnen Beitrag anzeigen

NormanNG

Registriert seit: 1. Feb 2006
294 Beiträge
 
Delphi 2007 Professional
 
#4

Re: SQL-Abfrage optimieren

  Alt 27. Feb 2008, 11:47
Hi,

hier könnte sicher ein Group-By helfen...

SQL-Code:
SELECT *
FROM ADRESSEN
WHERE ADRESSEN.IDNR IN (
   SELECT IDNR
   FROM ADRESSEN
      INNER JOIN ADRESSGRU ON
         (ADRESSEN.IDNR = ADRESSGRU.ADR_ID) AND
         (GR_ID=5 OR GR_ID=39 /* OR [...] (wird dynamisch hinzugefügt) */)
   group by IDNR
)
ORDER BY NAME1 ASC
Gruß
Norman
  Mit Zitat antworten Zitat