Auch SQL kennt IF.
SQL schon, aber ich nicht :-)
Vielen Dank schon mal, aber so ganz bekomme ich es nicht hin:
SELECT IF ((SELECT 1 FROM tabelle WHERE bedingung = 8),
(SELECT wert FROM tabelle WHERE bedingung = 8),
(SELECT wert FROM tabelle WHERE bedingung = 3)
)
AS wert
FROM tabelle
liefert mir das Ergebnis mehrmals, d.h. so oft, wie die Tabelle Einträge hat.
Und sonderlich schön sieht die query auch noch nicht aus.
Mach ich da einen Denkfehler? Geht das einfacher?
Danke.