SQL-Question
Claudius Sailer
Claudius at sailer-online.de
Sun Mar 6 21:15:45 CST 2005
Am 06. Mrz 2005 um 12:25 Uhr schrieb Ruslan Zasukhin:
> Btw, may be you can solve OR join using UNION of 2 SELECTs
I would expect that following SQL should work, but I get
Error: line 3:1: unexpected token: null
SELECT B.RecID, B.BDatum, KZ.Konto_Name, K.Kategorie_Name,
B.Betrag,
null,
B.Kommentar, B.Blocked
FROM Buchungen B, Kategorien K, Konten KZ
WHERE B.Kategorie_ID=K.RecID
AND (B.Ziel_Konto=KZ.RecID AND B.Herk_Konto='13')
AND B.Deleted='0'
UNION
SELECT B.RecID, B.BDatum, KZ.Konto_Name, K.Kategorie_Name,
null,
B.Betrag,
B.Kommentar, B.Blocked
FROM Buchungen B, Kategorien K, Konten KZ
WHERE B.Kategorie_ID=K.RecID
AND (B.Herk_Konto=KZ.RecID AND B.Ziel_Konto='13')
AND B.Deleted='0'
ORDER BY B.BDatum, KZ.Konto_Name, K.Kategorie_Name
Then I tested follwowing
SELECT B.RecID, B.BDatum, KZ.Konto_Name, K.Kategorie_Name,
B.Betrag,
0,
B.Kommentar, B.Blocked
FROM Buchungen B, Kategorien K, Konten KZ
WHERE B.Kategorie_ID=K.RecID
AND (B.Ziel_Konto=KZ.RecID AND B.Herk_Konto='13')
AND B.Deleted='0'
UNION
SELECT B.RecID, B.BDatum, KZ.Konto_Name, K.Kategorie_Name,
0,
B.Betrag,
B.Kommentar, B.Blocked
FROM Buchungen B, Kategorien K, Konten KZ
WHERE B.Kategorie_ID=K.RecID
AND (B.Herk_Konto=KZ.RecID AND B.Ziel_Konto='13')
AND B.Deleted='0'
ORDER BY B.BDatum, KZ.Konto_Name, K.Kategorie_Name
and I get NULL where I expect 0!!!
I will make new Bug Entry ;-)) #533
But UNION itself works fine :-))
bye
Claudius
P.S. I am sorry that I have so much SQL-Statements that doesn't work,
so I have to make new Bug Entries. But I like Mantis and Valentina.
Really good Tool and Application.
More information about the Valentina-beta
mailing list