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.

[Access] Durchschnittswerte

Empfohlene Antworten

Veröffentlicht

Moinsens!

Auch wenn ich jetzt wahrscheinlich aufgrund der Benutzung von Access einen auf den Deckel krieg ich poste es trotzdem *gg*

Ich habe leichte probleme mit dem Berechnen von Durchschnittswerten in Access 2000.

Ich will aus einer DB-Tabelle mit Login/Logout-Zeitstatistiken einen Graphen basteln, der mir durchschnittliche Login-Durations PRO MONAT ausgibt.

Ich habe eine Tabelle

activityTable


ID	username	logintime	logofftime

1	administrator	21.01.2006 12:54:00	21.01.2006 12:59:00

2	administrator	26.01.2006 12:54:00	26.01.2006 13:05:00

3	service1	23.01.2006 12:54:00	23.01.2006 14:12:00

4	service4	01.05.2005 12:53:00	01.05.2005 12:56:00

5	service4	21.01.2006 14:06:00	21.01.2006 16:54:00

6	service2	03.02.2006 12:10:00	03.02.2006 12:55:00

und 2 Abfragen sessionDurations:

SELECT [activityTable].[logintime], [activityTable].[logofftime], DateDiff("n",[activityTable].[logintime],[activityTable].[logofftime]) AS sessionDurationMinutes, Month([activityTable].[logintime]) AS [month]

FROM activityTable;

sessionsPerMonth:

SELECT COUNT([month]) AS sessionsInMonth, [month]

FROM sessionDurations

GROUP BY [month];

Nun möchte ich in die Abfrage "sessionsPerMonth" gerne noch ein Feld mit der durchschnittlichen Login-Zeit der Benutzer einbauen, aber ich raff es nicht wie ich das hinkrieg ... das muss doch irgendwie gehen ...

Es ist jetzt nicht unbedingt soooo wichtig, da die eigentliche Implementierung der ganzen Sache nicht in access sondern in Java mit JChart und unseren Anwendungsinternen logfiles passiert, aber es interessiert mich trotzdem ob ich einfach nur zu doof bin :P

Also

schönen Dank schonma

Eth

hab das mal spasseshalber versucht:

sessionsPerMonthSum

SELECT DISTINCTROW sessionDurations.month, Sum(DateDiff("n",[activityTable].[logintime],[activityTable].[logofftime])) AS sessionDurationMinutes, sessionDurations.username

FROM activityTable INNER JOIN (sessionsPerMonth INNER JOIN sessionDurations ON sessionsPerMonth.month = sessionDurations.month) ON (activityTable.logofftime = sessionDurations.logofftime) AND (activityTable.logintime = sessionDurations.logintime) AND (activityTable.username = sessionDurations.username)

GROUP BY sessionDurations.month, sessionDurations.username;
schaut wild aus und ist vielelicht auch ohne 4 joins lösbar, liefert aber scheinbar richtige daten :D
month	sessionDurationMinutes	username

1	16	administrator

1	78	service1

1	168	service4

2	45	service2

5	3	service4

s'Amstel

Danke für die Mühe, aber wo finde ich in deiner Antwort die durchschnittliche Login-Zeit pro Monat?

Ich bräuchte irgendwie so ne ähnliche Ausgabe wie:

month averageLoginTime

1 3.5

2 4.7

5 4.3

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.