473,767 Members | 1,735 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

Question on selecting dates in a query

1 New Member
I am an infrequent user and my version is Access 2000. I have a list of 122k lines which consits of 3 fields/data points;a product code, a date, and a price code. I want to run a query to select the latest date the product code was entered and return the price code associated with the date. There are entrys for many different dates, none of them are the same. I have pulled all the data into access but can not figure out how to get just the latest or greatest date with its associated code.
Nov 22 '06 #1
1 2281
MMcCarthy
14,534 Recognized Expert Moderator MVP
I am an infrequent user and my version is Access 2000. I have a list of 122k lines which consits of 3 fields/data points;a product code, a date, and a price code. I want to run a query to select the latest date the product code was entered and return the price code associated with the date. There are entrys for many different dates, none of them are the same. I have pulled all the data into access but can not figure out how to get just the latest or greatest date with its associated code.
this should do it ...

Expand|Select|Wrap|Line Numbers
  1.  
  2. SELECT [Product code], Max([Date]) As LatestDate, DLookup("[Price code]", "TableName", "[Date]=" & LatestDate & " And [Product code]=" & [Product code]) As PriceCode
  3. FROM TableName
  4. GROUP BY [Product code];
  5.  
Nov 23 '06 #2

Sign in to post your reply or Sign up for a free account.

Similar topics

1
1355
by: Mark | last post by:
Hi - I have a numebr of rooms, which I am making available. table: single - has single_id and single_name rental_single has rental_id, single_id, check_in and check_out They are linked by single_id. I want to query so that when given two dates, it will return the single_id that is free between two dates, which means I need to exclude a singe_id if it has a linked entrey in the rental_single table, which
3
1942
by: Dino | last post by:
I am creating a website that is going to ask the user to enter a date! then from an access database get all records where a date field is greater then the date entered! Sounds simple, I do it in vb all the time! here is my sql line: Select * From Participants WHERE DateJoined > 01/14/07 ORDER BY TournamentID it updates fine with the date the user has entered! I know in vb I need to put ## around the date I am comparing! I tried...
8
2753
by: DH | last post by:
Say I have a table with two columns that matter to this example, and . And here is an example of what the rows currently look like: , 1,6/27/2001 1,6/27/2001 1,5/31/2001 2,6/27/2001 2,6/30/2001
2
2002
by: Catherine | last post by:
I have a database where in my query I need to be able to locate accounts that show a date greater than 14 days from the current date. How would I structure this to allow for all accounts that over 14 days old from today's date? Any help you can give me would be greatly appreciated.
1
1675
by: Mike Cooper | last post by:
Hi everyone, This is a tough one. I have a database full of solicitations, identifying a customer and recording initial call, first followup, second followup, etc. My boss want to be able to generate a report showing a list of customer who were call between two different dates that he types into a form. That, I have done. My boss types in his two dates, the SQL statement searches through the follow-up call fields for a date
1
1292
by: DougS | last post by:
Is it possible to highlight more than one date in the calendar control? I'm trying to display a calendar to the user and highlight the dates that have action items. Is this possible? Or is this control just for selecting dates?
1
1900
by: vunderusaf | last post by:
I have a listbox on a form that is selecting using named FinalQuery: SELECT ., ., . FROM FinalQuery; Now I have a text field with a date on this form and I'd like to use that date as the selection criteria, comparing to the ... how would I use a field with the WHERE clause?
4
1613
by: Good Man | last post by:
Hi there I have a list of jobs scheduled in a MySQL table, with start dates and end dates, like so: SchedID | JobID | StartDate | EndDate | ---------------------------------------------- 1 5 2006-05-08 2006-05-09 2 8 2006-05-10 2006-05-12 3 3 2006-05-01 2006-05-19
4
2851
by: rekhasc | last post by:
hi friends.. i am using sql server 2005 reporting services.. in database the table contains startdate row and enddate row... i want the query which display all the contents between these dates... when i externaly pass the startdate and enddate SELECT * FROM tmpFilePendStatPost Where seccd=@seccd
0
9571
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 usage, and What is the difference between ONU and Router. Let’s take a closer look ! Part I. Meaning of...
1
9960
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows Update option using the Control Panel or Settings app; it automatically checks for updates and installs any it finds, whether you like it or not. For most users, this new feature is actually very convenient. If you want to control the update process,...
0
9841
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 choice of these technologies. I'm particularly interested in Zigbee because I've heard it does some...
1
7383
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 instead of User Defined Types (UDT). For example, to manage the data in unbound forms. Adolph will...
0
6655
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 into image. Globals.ThisAddIn.Application.ActiveDocument.Select();...
0
5280
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 the same network. But I'm wondering if it's possible to do the same thing, with 2 Pfsense firewalls...
0
5424
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
1
3930
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
3
2807
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 effective websites that not only look great but also perform exceptionally well. In this comprehensive...

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.