Neuigkeiten:

Wenn ihr euch für eine gute Antwort bedanken möchtet, im entsprechenden Posting einfach den Knopf "sag Danke" drücken!

Mobiles Hauptmenü

Anzahl gefilterteter Einträge in Queries

Begonnen von Kannkaumvba, Oktober 18, 2015, 08:38:58

⏪ vorheriges - nächstes ⏩

Kannkaumvba

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!

DF6GL

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
Viele Grüße vom Bodensee
Franz, DF6GL

Hilfestellung:  http://www.access-o-mania.de/forum/index.php?topic=6969.msg118738#msg118738

Links und Tipps:
1.   http://v.hdm-stuttgart.de/~riekert/lehre/db-kelz/
1a. http://www.tinohempel.de/info/info/datenbank/normalisierung.htm
1b. https://support.office.com/de-de/article/Grundlagen-des-Datenbankentwurfs-eb2159cf-1e30-401a-8084-bd4f9c9ca1f5#bmterms
2.   http://www.donkarl.com
3.   https://web.archive.org/web/20201201233522/http://www.dbwiki.net/
4.   http://www.access-tutorial.de/
5.   http://www.tty1.net/smart-questions_de.htm
6.   http://access.joposol.com/accept

Last but not least:   < F1 > für Hilfe
;) Learning by doing not by spoon-feed ;)

Tipp: Find and Replace for Access

Kannkaumvba

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