473,569 Members | 2,834 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

Query to select latest date among several

I have a query that returns this recordset:
Bob, 1/1/2000
Bob, 3/1/2001
Bob, 2/4/2004
Bob, 5/9/2002

I need the query to return this instead:
Bob, 2/4/2004

So, it needs to return the most recent date in records that otherwise
have repeating data.

Thanks for any tips!
Nov 13 '05 #1
2 7054
Group By Name and select Max of Date
"John" <so*********@ho tmail.com> wrote in message
news:90******** *************** ***@posting.goo gle.com...
I have a query that returns this recordset:
Bob, 1/1/2000
Bob, 3/1/2001
Bob, 2/4/2004
Bob, 5/9/2002

I need the query to return this instead:
Bob, 2/4/2004

So, it needs to return the most recent date in records that otherwise
have repeating data.

Thanks for any tips!

Nov 13 '05 #2
Thanks Adrian; however, I thought I'd be able to figure out a more
complex problem by making it simpler. What if there's a third field
that makes the record unique. Example
Bob, 1/1/2000, $19.98
Bob, 3/1/2001, $24.98
Bob, 2/4/2004, $29.98
Bob, 5/9/2002, $26.98

The query still needs to return the most recently dated record:
Bob, 5/9/2002, $26.98

Using MAX on the date field still returns multiple records due to the
price field making them unique. Any suggestions?

"Adrian Tofan" <x@x.x> wrote in message news:<tH******* **************@ twister01.bloor .is.net.cable.r ogers.com>...
Group By Name and select Max of Date
"John" <so*********@ho tmail.com> wrote in message
news:90******** *************** ***@posting.goo gle.com...
I have a query that returns this recordset:
Bob, 1/1/2000
Bob, 3/1/2001
Bob, 2/4/2004
Bob, 5/9/2002

I need the query to return this instead:
Bob, 2/4/2004

So, it needs to return the most recent date in records that otherwise
have repeating data.

Thanks for any tips!

Nov 13 '05 #3

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

Similar topics

4
4018
by: Si | last post by:
Hi there. I have a page on a website I am building where is want to look for all records added in the last 60 days. The date is added in short UK format, that is 25/12/2003 in an access database. (set as a date field) I am using <% session.lcid=2057 %> in my header to force UK date format.
9
3115
by: netpurpose | last post by:
I need to extract data from this table to find the lowest prices of each product as of today. The product will be listed/grouped by the name only, discarding the product code - I use SUBSTRING(ProductName, 1, CHARINDEX('(', ProductName)-2). I can get this result, but I had to use several views (totally inefficient). I think this can be...
2
18688
by: Dom | last post by:
I need to run a query based on a query in Access. The second query has a number of conditions which all work well, but there is one more contition I need to set to make it run properly. the first query returns a number of data items, consisting, among other fields, of a Company_ID and a Rating_Date. For most companies, the latest value of...
8
17216
by: Bill | last post by:
Hello out there; This may be a challenge but I'm certain it's possible but I can't seem to figure out how. I have a table that has several date fields, e.g., Date1, Date2, Date3, Date4 ... etc. I wish to find out either of two things for each row. 1) What is the maximun date in any of the date fields in the row.
5
3500
by: Irfan | last post by:
Hi All, I am trying to create a report but having problem with the critiera selection logic, please help. I have the following fields date1 date2 date3
5
363
by: Jim Devenish | last post by:
I have a number of pieces of equipment, each of which gets serviced from time to time. At a service, one or more pieces of equipment will be serviced. I have two relevant tables: Services: Fields: ServiceID (primary) ServiceDate EquipmentServices:
7
6335
by: Scott Frankel | last post by:
Still too new to SQL to have run across this yet ... How does one return the latest row from a table, given multiple entries of varying data? i.e.: given a table that looks like this: color | date --------+------------ red | 2004-01-19 blue | 2004-05-24
24
19881
by: clare at snyder.on.ca | last post by:
I have a SQL query I need to design to select name and email addresses for policies that are due and not renewed in a given time period. The problem is, the database keeps the information for every renewal in the history of the policyholder. The information is in 2 tables, policy and customer, which share the custid data. The polno changes...
5
1720
by: Merennulli | last post by:
To start with, I'll give a simplified overview of my data. BaseRecord (4mil rows, 25k in each Region) ID | Name | Region | etc OtherData (7.5mil rows, 1 or 2 per ID) ID | Type(1/2) | Data ProblemTable (4mil rows) ID | ConcatenatedHistory
0
7693
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However, people are often confused as to whether an ONU can Work As a Router. In this blog post, we’ll explore What is ONU, What Is Router, ONU & Router’s main...
0
7917
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers, it seems that the internal comparison operator "<=>" tries to promote arguments from unsigned to signed. This is as boiled down as I can make it. ...
0
7962
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each protocol has its own unique characteristics and advantages, but as a user who is planning to build a smart home system, I am a bit confused by the...
0
6277
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing, and deployment—without human intervention. Imagine an AI that can take a project description, break it down, write the code, debug it, and then...
1
5501
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 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 a new presenter, Adolph Dupré who will be discussing some powerful techniques for using class modules. He will explain when you may want to use classes...
0
5217
by: conductexam | last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and then checking html paragraph one by one. At the time of converting from word file to html my equations which are in the word document file was convert...
0
3651
by: TSSRALBI | last post by:
Hello I'm a network technician in training and I need your help. I am currently learning how to create and manage the different types of VPNs and I have a question about LAN-to-LAN VPNs. The last exercise I practiced was to create a LAN-to-LAN VPN between two Pfsense firewalls, by using IPSEC protocols. I succeeded, with both firewalls in...
1
2105
by: 6302768590 | last post by:
Hai team i want code for transfer the data from one system to another through IP address by using C# our system has to for every 5mins then we have to update the data what the data is updated we have to send another system
0
933
bsmnconsultancy
by: bsmnconsultancy | last post by:
In today's digital era, a well-designed website is crucial for businesses looking to succeed. Whether you're a small business owner or a large corporation in Toronto, having a strong online presence can significantly impact your brand's success. BSMN Consultancy, a leader in Website Development in Toronto offers valuable insights into creating...

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.