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.

SQL Abfrage - Prozentuale Auslastung eines Hotels

Empfohlene Antworten

Veröffentlicht

Ich versuche gerade, ausschließlich durch SQL-Befehle die Auslastung eines Hotels zu bestimmen:

folgendermaßen gehe ich dabei vor:


[I]Zeitraum der Zimmerbelegung:[/I]

UPDATE    Personen

SET         Zeitraum = DATEDIFF(day, CheckIn, CheckOut)

WHERE    (ID BETWEEN 1 AND 12)


[I]Aufsummierung aller belegten Tage:[/I]

SELECT    SUM(Zeitraum) AS GesTage

FROM       Personen


[I]Dreisatz zur %-Bestimmung:[/I]

UPDATE    Hotel

SET       Auslastung = (100 * GesTage) / (16 * 365)

WHERE     Hotel LIKE 'Alex'


[I]Ausgabe der Auslastung und Belegungstage:[/I]

SELECT    Auslastung, GesTage

FROM      Hotel

Leider wird die Abfrage nur bis zur Summierung ausgeführt. Die Auslastung wird jedoch nicht in die gewünschte Tabelle (Hotel) geschrieben.

Bin für jeden Ratschlag dankbar!

es hilft generell anzugeben, welches DBMS du verwendest (auch wenn das stinknormales SQL ist, allerdings gibt es eben prozedurale spezifika und du hast das z.b. in einer stored procedure).

woher stammt bei dir "GesTage" im 2. UPDATE. das muss ja irgendwo herkommen, sei es als feld, sei es als variable.

s'Amstel

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.