Hallo zusammen,
für das Feld [AktID] (Format Zahl, Primärschlüssel) in tbl1 werden über 1:n-Verknüpfung mehrere Einträge in tbl2 zugeordnet [AktID] (Format Zahl, Fremdschlüssel), weitere Felder: [KomID] (Format Zahl, Primärschlüssel), [Kom] (Format Memo) , [KomDat] (Format Datum).
In einer Abfrage für Einträge in tbl1 möchte aus tbl2 folgendes anzeigen lassen: Anzahl tbl2[KomID] zu tbl1[AktID] 0 bis n; letzten Eintrag tbl2[Kom] über tbl2[KomDat].
Bis jetzt habe ich eine Abfrage, die die Anzahl [KomID] angibt. Diese zeigt natürlich nur Einträge denen ein [KomD] zugeordnet ist. Mir fehlen also die Nuller.
Hat jemand eine Idee, wie dies zu lösen ist?
Vielen Dnak im voraus!
Hallo,
z. B.
Select tbl1.AktID, nz(Dcount("*","tbl2","AktID=" & tbl1.AktID),0) from tbl1 order by AktID
oder
Select tbl1.AktID, (Select count(*) from tbl2 where tbl2.AktID=tbl1.AktID) as Anz from tbl1
Hallo Franz,
so simpel wie genial!!!
Mir scheint, ich denke viel zu kompliziert. In SQL siehts bei mir aber auch wie bei VBA aus: Nicht so gut.
Vielen Dank für diesen wertvollen Tipp!!!
Gruss