Registriert seit: 6. Jan 2007
149 Beiträge
Delphi XE Professional
|
Re: Master / detail haut nicht hin!
13. Jan 2007, 10:55
CREATE TABLE "RECHNUNG"
(
"Re_Nr" INTEGER NOT NULL,
"Datum" DATE NOT NULL,
"MWST" SMALLINT NOT NULL,
"KD_ID" INTEGER NOT NULL,
"Anmerkung" "STR(100)",
PRIMARY KEY ("Re_Nr")
);
CREATE TABLE "RECH_DETAIL"
(
"ID" INTEGER NOT NULL,
"Re_ID" INTEGER NOT NULL,
"Art_ID" INTEGER NOT NULL,
"MENGE" INTEGER DEFAULT 1 NOT NULL,
"Preis_NETTO" DOUBLE PRECISION,
"Anmerkung" "TSTR(50)",
PRIMARY KEY ("ID")
);
Mastertabelle:
select "RECHNUNG"."Anmerkung","Re_Nr","Datum","MWST","KD_ ID","Firma",ANREDE."Anrede" ||
' '|| "Kontakt_Vorname"||' '||"Kontakt_Name" AS "Kontakt_Person",
"TelefonNr",
"PLZ"||' '||"ORT"||' '||"STRASSE"||"HausNr" AS "Anschrift"
FROM RECHNUNG,KUNDE,ANREDE
WHERE "KD_ID"="KUNDE"."ID" AND "KUNDE"."ANREDE"="ANREDE"."ID"
Detailtabelle:
SELECT
RECH_DETAIL."ID", "Art_ID", "Re_ID", "MENGE", "Preis_NETTO", "ArtNr", "Bezeichnung","Anmerkung"
FROM RECH_DETAIL, PALETTE, RECHNUNG
WHERE "Art_ID"=PALETTE."ID" AND "Re_Nr"="Re_ID"
|