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-string Fehler!

Empfohlene Antworten

Hallo habe folgendes sql-statement:


Select @num2 = sum(netto),@num14 = sum(netto) 

from sysadm.stat0 AS S 

where so0_nrid = @so0_nrid and jahr = year(getdate())-1 and template is null

and (periode >=1 and periode <= max(periode))

das mit der periode haut so nicht hin folgende fehlermeldung:
Meldung 147, Ebene 15, Status 1, Zeile 1

An aggregate may not appear in the WHERE clause unless it is in a subquery contained in a HAVING clause or a select list, and the column being aggregated is an outer reference.

bitte um hilfe!

gruß alex

Schau dir mal Group by und Having an.

Dein Statement macht so nämlich keinen Sinn. Alles ist <= die höchste Angabe im Feld Periode. Bezweifel das du das möchtest.

wollte max(periode) vom aktuellen jahr:


Select sum(netto),sum(netto) 

from sysadm.stat0 AS S 

where so0_nrid = 20292180697446 and jahr = year(getdate())-1 and template is null

and (periode >=1 and periode <= (select max(periode) from sysadm.stat0 where jahr = year(getdate())))

so funktionierts.

gruß alex

Archiv

Dieses Thema wurde archiviert und kann nicht mehr beantwortet werden.

Konto

Navigation

Suchen

Suchen

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.