Zum Inhalt springen
View in the app

A better way to browse. Learn more.

Fachinformatiker.de

A full-screen app on your home screen with push notifications, badges and more.

To install this app on iOS and iPadOS
  1. Tap the Share icon in Safari
  2. Scroll the menu and tap Add to Home Screen.
  3. Tap Add in the top-right corner.
To install this app on Android
  1. Tap the 3-dot menu (⋮) in the top-right corner of the browser.
  2. Tap Add to Home screen or Install app.
  3. Confirm by tapping Install.

Zählen in Verbindung mit decode

Empfohlene Antworten

Veröffentlicht

Hallo, ich bin wieder an den Lektionen und habe hierzu eine Frage:

Gewünscht:

zählen der Tabelle aus der spalte alle stationären, ambulanten und sonstigen Fällen, welche wie folgt ausgegeben werden sollen:

Fall-Status Menge

Stationär (Zahl)

Ambulant (Zahl)

Sonstige (Zahl)

Soweit habe ich das, aber wie kann ich die Spalte Menge so Zählen lassen?

Lösungsansatz:

select decode (hostatus, 'S', 'Stationär', 'A', 'Ambulant', 'T', 'Sonstige', hostatus) as "Fall-Status";

from hohospitalisation;

where hoaufnahmedatum > '01.01.2004' and hoaufnahmedatum < '31.12.2004';

Ich hätte noch einen anderen Lösungsansatz, aber der entspricht nicht der Lösung, da kein decode enthalten wäre.

Welche Oracleversion, mittlerreweile kannst du statt decode CASE nehmen.


select decode (hostatus, 'S', 'Stationär', 'A', 'Ambulant', 'T', 'Sonstige', hostatus) as "Fall-Status";

from hohospitalisation;

where hoaufnahmedatum > '01.01.2004' and hoaufnahmedatum < '31.12.2004';


SELECT CASE

WHEN hostatus='S' THEN 'Stationär'

WHEN hostatus='A' THEN 'Ambulant'

WHEN hostatus='T' THEN 'Sonstige'

ELSE hostatus='Fehler'

as "Fall-Status"

END, sum(hostatus) as Anzahl

FROM hohospitalisation;

WHERE hoaufnahmedatum > '01.01.2004' and hoaufnahmedatum < '31.12.2004'

GROUP BY hostatus;


:D isch sage mal dankeschöööön

habe zwar noch was anpassen müssen da er nicht so das direkt genommen hat:

Server: Nachr.-Nr. 195, Schweregrad 15, Status 10, Zeile 1

'decode' is not a recognized function name.

Server: Nachr.-Nr. 170, Schweregrad 15, Status 1, Zeile 9

Line 9: Incorrect syntax near '='.

Aber super im Endefekt habe ich mein Ergebnis und kann mir das gut herleiten.

Archiv

Dieses Thema wurde archiviert und kann nicht mehr beantwortet werden.

Configure browser push notifications

Chrome (Android)
  1. Tap the lock icon next to the address bar.
  2. Tap Permissions → Notifications.
  3. Adjust your preference.
Chrome (Desktop)
  1. Click the padlock icon in the address bar.
  2. Select Site settings.
  3. Find Notifications and adjust your preference.