Zum Inhalt springen

Mr. Database

Mitglieder
  • Gesamte Inhalte

    2
  • Benutzer seit

  • Letzter Besuch

Alle Inhalte von Mr. Database

  1. Also muss erstmal zustimmen: am besten wäre es die Tabelle zu normalisieren: Es gibt jedoch auch eine Lösung über sql, jedoch ist diese Extrem umständlich und lang, da ist es wohl wirklich besser, das ganze über den PHP Code abzufragen: Hier trotzdem die SQL Lösung: select sum(anzahl) as vorkommnis from ( select count(*) as anzahl from eintraege where VWA1 in (select zahl from gruppe1) and eintraege.datum < #01/01/2004# and eintraege.datum > #01/01/2001# union all select count(*) as anzahl from eintraege where VWA2 in (select zahl from gruppe1) and eintraege.datum < #01/01/2004# and eintraege.datum > #01/01/2001# union all select count(*) as anzahl from eintraege where VWA3 in (select zahl from gruppe1) and eintraege.datum < #01/01/2004# and eintraege.datum > #01/01/2001# union all select count(*) as anzahl from eintraege where VWA4 in (select zahl from gruppe1) and eintraege.datum < #01/01/2004# and eintraege.datum > #01/01/2001# union all select count(*) as anzahl from eintraege where VWA5 in (select zahl from gruppe1) and eintraege.datum < #01/01/2004# and eintraege.datum > #01/01/2001# union all select count(*) as anzahl from eintraege where VWA6 in (select zahl from gruppe1) and eintraege.datum < #01/01/2004# and eintraege.datum > #01/01/2001# union all select count(*) as anzahl from eintraege where VWA7 in (select zahl from gruppe1) and eintraege.datum < #01/01/2004# and eintraege.datum > #01/01/2001# union all select count(*) as anzahl from eintraege where VWA8 in (select zahl from gruppe1) and eintraege.datum < #01/01/2004# and eintraege.datum > #01/01/2001# union all select count(*) as anzahl from eintraege where VWA9 in (select zahl from gruppe1) and eintraege.datum < #01/01/2004# and eintraege.datum > #01/01/2001# union all select count(*) as anzahl from eintraege where VWA10 in (select zahl from gruppe1) and eintraege.datum < #01/01/2004# and eintraege.datum > #01/01/2001# ) ; Dabei gehe ich davon aus dass die Tabelle mit den Spalten VWA ... eintraege heißt, und die Tabelle mit den Zahlen einer Gruppe gruppe1 (spalte zahl) heißt. Dies könnte man bei mehrern Gruppen natürlich auch in einer Tabelle zusammenfassen! Wenn du an der DB nichts extrem ändern willst würde ich dir raten, das ganze wirklich über einfache selects in PHP zu realisieren! Ich hoffe dass hilft dir etwas weiter! Gruß Mr. Database
  2. Hi, wie hast du deine Tabellen für die Gruppen aufgebaut? z.B. Gruppe1 --> Feld Zahlen --> Einträge: 40 41 ... 49 oder eher so: Gruppe1 --> Felder: von, bis -->einträge: 40 49 ? Die 2 Frage wäre, willst du die Anzahl der Datensätze wissen die in Werte aus der Gruppe enthalten (also egal in welcher Spalte 1-10) --> ein DS wird nur 1mal gezählt, auch wenn der Wert in Spalte 1 + 3 + 5 in der Gruppe enthalten ist. Oder soll dann Gezählt werden wie oft der Wert in der Ganzen Tabelle enthalten ist.--> z.B. Es sind 104 Einträge der Gruppe1 zuzuordnen. oder willst du dies auch Spaltenspeziefisch lösen z.B. IN der Spalte VAW 1 sind 43 Einträge aus der Gruppe1 enthalten...

Fachinformatiker.de, 2024 by SE Internet Services

fidelogo_small.png

Schicke uns eine Nachricht!

Fachinformatiker.de ist die größte IT-Community
rund um Ausbildung, Job, Weiterbildung für IT-Fachkräfte.

Fachinformatiker.de App

Download on the App Store
Get it on Google Play

Kontakt

Hier werben?
Oder sende eine E-Mail an

Social media u. feeds

Jobboard für Fachinformatiker und IT-Fachkräfte

×
×
  • Neu erstellen...