Duane Hookom MVP
MS Access
To: MS_Access_Professionals@yahoogroups.com
From: MS_Access_Professionals@yahoogroups.com
Date: Tue, 4 Nov 2014 19:04:22 +0100
Subject: Re: [MS_AccessPros] Stuck on query totals
Ummm. My wife might take objection to that!

OMG John, I could just kiss you. Thank you so much! It is precisely what I need.
From: MS_Access_Professionals@yahoogroups.com [mailto:MS_Access_Professionals@yahoogroups.com]
Sent: Tuesday, November 04, 2014 10:32 AM
To: MS_Access_Professionals@yahoogroups.com
Subject: Re: [MS_AccessPros] Stuck on query totals
Liz-
SELECT DW.WhichDatabase, Count(DW.UserLoggedIn) As CountOfUniqueUsers
FROM
(SELECT DISTINCT WhichDatabase, UserLoggedIn
FROM LogStats
WHERE LogStats.TimeLoggedIn >= (Date()-30)) As DW
GROUP BY DW.WhichDatabase;
John Viescas, Author
Microsoft Access 2010 Inside Out
Microsoft Access 2007 Inside Out
Microsoft Access 2003 Inside Out
Building Microsoft Access Applications
SQL Queries for Mere Mortals
(Paris, France)
On Nov 4, 2014, at 6:14 PM, Liz Ravenwood liz_ravenwood@beaerospace.com [MS_Access_Professionals] <MS_Access_Professionals@yahoogroups.com> wrote:
Thanks for your quick reply John,
What if I want a count of users logged in by which database?
Like ADCN – 2 (even though 2 users logged in a total of 4x)
From: MS_Access_Professionals@yahoogroups.com [mailto:MS_Access_Professionals@yahoogroups.com]
Sent: Tuesday, November 04, 2014 9:26 AM
To: MS_Access_Professionals@yahoogroups.com
Subject: Re: [MS_AccessPros] Stuck on query totals
Liz-
Well, your query will give you a count of all login records for the last 30 days by database. If you want a count by user logged in by date, you must add UserLoggedIn to the query and Group By. If you want a count of the different users, you must first SELECT DISTINCT WhichDatabase, DatePart(TimeLoggedIn) As LoginDate, UserLoggedIn FROM LogStats, then count that. If you just want a count of the different number of users, remove the LoginDate from the above DISTINCT query.
John Viescas, Author
Microsoft Access 2010 Inside Out
Microsoft Access 2007 Inside Out
Microsoft Access 2003 Inside Out
Building Microsoft Access Applications
SQL Queries for Mere Mortals
(Paris, France)
On Nov 4, 2014, at 5:15 PM, Liz Ravenwood liz_ravenwood@beaerospace.com [MS_Access_Professionals] <MS_Access_Professionals@yahoogroups.com> wrote:
John. There are 4 fields in this table: WhichDatabase, TimeLoggedIn, TimeLoggedOut, UserLoggedIn and that is all.
From: MS_Access_Professionals@yahoogroups.com [mailto:MS_Access_Professionals@yahoogroups.com]
Sent: Tuesday, November 04, 2014 9:09 AM
To: MS_Access_Professionals@yahoogroups.com
Subject: Re: [MS_AccessPros] Stuck on query totals
Liz-
What are the other fields in the table?
John Viescas, Author
Microsoft Access 2010 Inside Out
Microsoft Access 2007 Inside Out
Microsoft Access 2003 Inside Out
Building Microsoft Access Applications
SQL Queries for Mere Mortals
(Paris, France)
P.S. It's not a good idea to include your address and phone info in your signature - these messages get posted on the web where scammers can scoop up info like that.
On Nov 4, 2014, at 4:53 PM, Liz Ravenwood liz_ravenwood@beaerospace.com [MS_Access_Professionals] <MS_Access_Professionals@yahoogroups.com> wrote:
Greetings Pros,
I'm stuck on a query where I'm gathering usage data.
I am using a table called LogStats which captures the date logged in/out, the user, and the database.
My totals are not adding up correctly.
The easiest example is a small database where I have 4 logins from 2 users within the last 30 days. I have a query built that yields a count of 4 for these 2 users because I can't get the thing to show me 2 users logged in for that time period.
Here is the sql:
SELECT DISTINCTROW LogStats.WhichDatabase, Count(LogStats.UserLoggedIn) AS CountOfUserLoggedIn
FROM LogStats
WHERE (((LogStats.TimeLoggedIn)>Date()-30))
GROUP BY LogStats.WhichDatabase;
Please help. I am having a humbling experience because I think I should know better by now but ah well…
Respectfully,
Liz Ravenwood
This email (and all attachments) is for the sole use of the intended recipient(s) and may contain privileged and/or proprietary information. Any unauthorized review, use, disclosure or distribution is prohibited. If you are not the intended recipient, please contact the sender by reply e-mail and destroy all copies of the original message.
This email (and all attachments) is for the sole use of the intended recipient(s) and may contain privileged and/or proprietary information. Any unauthorized review, use, disclosure or distribution is prohibited. If you are not the intended recipient, please contact the sender by reply e-mail and destroy all copies of the original message.
This email (and all attachments) is for the sole use of the intended recipient(s) and may contain privileged and/or proprietary information. Any unauthorized review, use, disclosure or distribution is prohibited. If you are not the intended recipient, please contact the sender by reply e-mail and destroy all copies of the original message.
This email (and all attachments) is for the sole use of the intended recipient(s) and may contain privileged and/or proprietary information. Any unauthorized review, use, disclosure or distribution is prohibited. If you are not the intended recipient, please contact the sender by reply e-mail and destroy all copies of the original message.
Posted by: Duane Hookom <duanehookom@hotmail.com>
| Reply via web post | • | Reply to sender | • | Reply to group | • | Start a New Topic | • | Messages in this topic (9) |
Tidak ada komentar:
Posting Komentar