Autor Beitrag
OlliWausD
ontopic starontopic starontopic starontopic starontopic starontopic starontopic starontopic star
Beiträge: 212

Win 2000/XP
Delphi 5 Professional - Interbase/Firebird
BeitragVerfasst: Do 16.09.04 11:41 
hi leutz,

Ich hab noch n kleines Problem, das eigentlich schon gelöst ist, aber verbesserungswürdig ist:

Ich hab eine Auswertung in der ich einen bestimmten Wert der rechnung auslese:

ausblenden Quelltext
1:
Select Rechnung.Netto, ..... from Rechnung where .......					


Das Problem ist: das ich in einem bestimmten Fall den Nettowert Negativ dastellen muss.
Bis jetzt hab ich das in einer StoredProcedure gemacht. Funktioniert auch.

ausblenden Quelltext
1:
if (Fall tritt ein) then Nett = -Netto;					


Interessant wäre es aber, ob ich dies auch in einer normalen Query realisierbar ist, da es nicht gerade sehr schön ist, wegen diesem "Hundsschieß" eine StoredProcedure zu schreiben.

Kann ich in dies in einer Query realisieren???

mfg

OlliW

_________________
Take it easy
jasocul
ontopic starontopic starontopic starontopic starontopic starontopic starhalf ontopic starofftopic star
Beiträge: 6395
Erhaltene Danke: 149

Windows 7 + Windows 10
Sydney Prof + CE
BeitragVerfasst: Do 16.09.04 11:48 
Welche Datenbank? Oracle kennt den Befehl Decode. Seeehr mächtige Sache. Ist meines Wissens aber kein ANSI-SQL.
neojones
ontopic starontopic starontopic starontopic starontopic starhalf ontopic starofftopic starofftopic star
Beiträge: 1206
Erhaltene Danke: 1



BeitragVerfasst: Do 16.09.04 11:55 
Nach ANSI müsste es so gehen:

ausblenden Quelltext
1:
IF(Feld1 = 'Dein Wert', 'Ausgabe wenn wahr', 'Ausgabe wenn falsch') AS feldname					

_________________
Ha! Es compiliert! Wir können ausliefern!
OlliWausD Threadstarter
ontopic starontopic starontopic starontopic starontopic starontopic starontopic starontopic star
Beiträge: 212

Win 2000/XP
Delphi 5 Professional - Interbase/Firebird
BeitragVerfasst: Do 16.09.04 12:30 
sorry, hab ich vergessen :)

Datenbanksystem is Firebird

mfg

OlliW

_________________
Take it easy