|
-
Feb 18th, 2004, 04:23 PM
#1
Thread Starter
Registered User
Help CR and SQL Server
i'm trying to create a simple report to show daily log on.
Query on my SQL Server is : Select distinct ( fullname ) , eventdatetime from log where eventdatetime > '02-18-2004'.
based upon my user is logging many times a day , i would like to know how can i only show the first or the last time he logged.
Thanks in advance.
-
Feb 28th, 2004, 01:22 AM
#2
Hyperactive Member
I can't try it right not because I'm not at the office but here's a quick idea that would probably work. Sort it ASC or DESC based on the date and query using
SELECT TOP 1 DISTINCT.....
-
Mar 1st, 2004, 09:13 AM
#3
Hyperactive Member
OK this should work:
SELECT MAX(eventdatetime) FROM log WHERE EXISTS
(SELECT DISTINCT fullname, eventdatetime FROM log WHERE eventdatetime > '02/18/2004')
AND fullname = 'fullname'
You can use MAX or MIN to get the Hi and Low values of the date.
-
Mar 4th, 2004, 02:53 PM
#4
Thread Starter
Registered User
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|