473,320 Members | 2,027 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,320 software developers and data experts.

Highest Value For Each Person In the Database

Hi

Here's my problem.

Let's say i have a table which records whenever a user logs on to a
computer system.

So someone logs on and it records something like Fred, 10th March 2004
19:54

If Fred logs on again it will write another record to the database.

Same with Sally and Barbara and Bill and Jim etc.

So each user will have multiple records.

How do I do a query that shows me each user and the last time they
logged in (ie the highest LoggedIn value for that user).

By the way, if there's better ways to organise the data that's not an
issue as this is downloaded data I'm dealing with.

Many thanks

Al
Nov 13 '05 #1
2 1498
SELECT tbl_YourTable.UserID, Max(YourTable.TimeIn) AS Latest_In
FROM YourTable
GROUP BY YourTable.UserID;

"Alun" <al******@blueyonder.co.uk> wrote in message
news:3c**************************@posting.google.c om...
Hi

Here's my problem.

Let's say i have a table which records whenever a user logs on to a
computer system.

So someone logs on and it records something like Fred, 10th March 2004
19:54

If Fred logs on again it will write another record to the database.

Same with Sally and Barbara and Bill and Jim etc.

So each user will have multiple records.

How do I do a query that shows me each user and the last time they
logged in (ie the highest LoggedIn value for that user).

By the way, if there's better ways to organise the data that's not an
issue as this is downloaded data I'm dealing with.

Many thanks

Al

Nov 13 '05 #2
Doh hope I'm not posting this twice. Sorry if I am but am not sure my
other post got through.

Just to say thanks Mark that works a treat.

One other thing though. If I need to return an additional field (this
dataset has no UserIDs!) that is not part of the GROUP BY, is that
possible?

Again, thanks

Al

Mark wrote:
SELECT tbl_YourTable.UserID, Max(YourTable.TimeIn) AS Latest_In
FROM YourTable
GROUP BY YourTable.UserID;

"Alun" <al******@blueyonder.co.uk> wrote in message
news:3c**************************@posting.google.c om...
Hi

Here's my problem.

Let's say i have a table which records whenever a user logs on to a
computer system.

So someone logs on and it records something like Fred, 10th March 2004 19:54

If Fred logs on again it will write another record to the database.

Same with Sally and Barbara and Bill and Jim etc.

So each user will have multiple records.

How do I do a query that shows me each user and the last time they
logged in (ie the highest LoggedIn value for that user).

By the way, if there's better ways to organise the data that's not an issue as this is downloaded data I'm dealing with.

Many thanks

Al


Nov 13 '05 #3

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

2
by: Steven | last post by:
Hi there, I have a list of values that I am displaying in a table (Not using a loop) I want to be able to put a graphic next to the item with the hightest price. I have all of the prices in...
4
by: dmiller23462 | last post by:
So here's my problem.....I need to set up different email distributions based on which option in the following Select form has been chosen....For instance if "Putaway" is chosen it needs to email...
2
by: Dirtyweeker | last post by:
Hi, I have a database which records fitness test results of pupils. There are the usual name fields and then a series of fields holding results, e.g. field BP1 and field BP2; each of these...
21
by: Jaspreet | last post by:
I was working on some database application and had this small task of getting the second highes marks in a class. I was able to do that using subqueries. Just thinking what is a good way of...
19
by: Dennis | last post by:
I have a public variable in a class of type color declared as follows: public mycolor as color = color.Empty I want to check to see if the user has specified a color like; if mycolor =...
7
by: Jan | last post by:
Hi there, Is there a fast way to get the highest value from an array? I've got the array strStorage(intCounter) I tried something but it all and's to nothing If someone good helpme, TIA
17
by: rhitz1218 | last post by:
Hi, I'm trying to create a function that will sort a number's digits from highest to lowest. For example 1000 - will become 0001 or 1234 to 4321
3
by: markcash | last post by:
I have a web application where I am displaying the current inmate population for the county jail. Part of the information that I display is the mugshot. Unfortunately, they have changed the way...
9
daniel aristidou
by: daniel aristidou | last post by:
I have a database i use to file. when i insert a new record i want it to imediately insert the next value (file number).the problem is the value is acording to subject. eg Subject1 has a record...
0
by: DolphinDB | last post by:
Tired of spending countless mintues downsampling your data? Look no further! In this article, you’ll learn how to efficiently downsample 6.48 billion high-frequency records to 61 million...
0
isladogs
by: isladogs | last post by:
The next Access Europe meeting will be on Wednesday 6 Mar 2024 starting at 18:00 UK time (6PM UTC) and finishing at about 19:15 (7.15PM). In this month's session, we are pleased to welcome back...
0
by: Vimpel783 | last post by:
Hello! Guys, I found this code on the Internet, but I need to modify it a little. It works well, the problem is this: Data is sent from only one cell, in this case B5, but it is necessary that data...
0
by: jfyes | last post by:
As a hardware engineer, after seeing that CEIWEI recently released a new tool for Modbus RTU Over TCP/UDP filtering and monitoring, I actively went to its official website to take a look. It turned...
1
by: PapaRatzi | last post by:
Hello, I am teaching myself MS Access forms design and Visual Basic. I've created a table to capture a list of Top 30 singles and forms to capture new entries. The final step is a form (unbound)...
1
by: Defcon1945 | last post by:
I'm trying to learn Python using Pycharm but import shutil doesn't work
1
by: Shællîpôpï 09 | last post by:
If u are using a keypad phone, how do u turn on JavaScript, to access features like WhatsApp, Facebook, Instagram....
0
by: Faith0G | last post by:
I am starting a new it consulting business and it's been a while since I setup a new website. Is wordpress still the best web based software for hosting a 5 page website? The webpages will be...
0
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 3 Apr 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome former...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.