Autor Beitrag
Wuschl
ontopic starontopic starontopic starontopic starontopic starontopic starontopic starontopic star
Beiträge: 39



BeitragVerfasst: Fr 13.12.02 15:07 
Also ich hab 3 Tabellen. In einem Quickreport will ich die Daten zusammentragen und ausdrucken(das mit dem QR ist jetzt allerdings nicht so wichtig). Allerdings bekomme ich bei enem Feld immer einen totalen scheiß raus, hier habe ich mal den Code:
ausblenden Quelltext
1:
2:
3:
4:
5:
6:
7:
8:
9:
10:
11:
12:
13:
14:
15:
Select 
 tabelle1.Mitgliedsname,
 tabelle1.Vorname,
 tabelle1.Nachname,
 tabelle1.Strasse,
 tabelle1.plz,
 tabelle1.ort,
 sum(ifnull(tabelle2.betrag,0)),
 (sum(ifnull(tabelle2.betrag,0))*0.16) as Usteuer,
 ((sum(ifnull(tabelle2.betrag,0)))-(sum(ifnull(loginlogout_stats.betrag,0))*0.16))as Gesammtbetrag,
 sum(ifnull(tabelle3.betrag,0)
From server.tabelle1, server.tabelle2 left join tabelle3 using(Mitgliedsname)
where
 ifnull(tabelle1.Mitgliedsname = tabelle2.Mitgliedsname,0)
group by Mitgliedsname

Tabelle1 enthält die Mitgliedsdaten, Tabelle2 die Sitzungen, Tabelle3 enthält Rücklastschriften falls ein Mitgliedsbeitrag mal nicht abgebucht werden konnte und hier kommt eben immer nur *mist*e raus ich hab keine ahnung wieso!

mfg
Wuschl


Zuletzt bearbeitet von Wuschl am Fr 13.12.02 15:29, insgesamt 1-mal bearbeitet
wwerner
ontopic starontopic starontopic starontopic starontopic starontopic starontopic starontopic star
Beiträge: 185



BeitragVerfasst: Fr 13.12.02 15:10 
du hast ja tabelle 3 gar nicht verbunden mit den anderen tabellen

_________________
Gruß

Wolfgang

----------
zu hause ist es doch am schönsten
Wuschl Threadstarter
ontopic starontopic starontopic starontopic starontopic starontopic starontopic starontopic star
Beiträge: 39



BeitragVerfasst: Fr 13.12.02 15:29 
sorry hatte mich verschrieben nach dem left join sollte es natürlich tabelle3 heißen

gruß
Wuschl
smiegel
ontopic starontopic starontopic starontopic starontopic starontopic starontopic starhalf ontopic star
Beiträge: 992
Erhaltene Danke: 1

WIN 7
D7 Prof., C#, RAD XE Prof.
BeitragVerfasst: Sa 14.12.02 23:18 
Hallo,

und wie sind tabelle1 und tabelle2 miteinander verbunden? Wenn ich Dein Select richtig verstanden habe, sind tabelle2 und tabelle3 über einen join verbunden. Aber mit wem steht dann tabelle1 in Relation? Mit tabelle2 oder tabelle3?

_________________
Gruß Smiegel
Ich weiß, daß ich nichts weiß, aber ich weiß mehr als die, die nicht wissen, daß sie nichts wissen. (Sokrates)