473,386 Members | 1,647 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,386 software developers and data experts.

SQL to find minimum value for each Distinct record

Hello all,

I have a table looks like this in Access

Product Sale Date
A date
A date
A date
B date
B date
C date
C date
C date

I would like to write a query to find the minimum date (i.e. the date
of the first sale) for each product

Thus, the expected output would be

Product Sale Date
A min date
B min date
C min date

How can i do this using SQL in Access??

any help is greatly appreciated!

Alan

Jun 30 '06 #1
1 4546
1. Create a query using this table.

2.In query design, depress the Total button on the toolbar (upper sigma
icon.) Access adds a Total row to the grid.

3. Drag the Product field into the grid.
Accept Group By in the Total row under this field.

4. Drag the [Sale Date] field into the grid.
In the Total row, choose Min.

--
Allen Browne - Microsoft MVP. Perth, Western Australia.
Tips for Access users - http://allenbrowne.com/tips.html
Reply to group, rather than allenbrowne at mvps dot org.

<al*********@hotmail.co.uk> wrote in message
news:11**********************@p79g2000cwp.googlegr oups.com...
Hello all,

I have a table looks like this in Access

Product Sale Date
A date
A date
A date
B date
B date
C date
C date
C date

I would like to write a query to find the minimum date (i.e. the date
of the first sale) for each product

Thus, the expected output would be

Product Sale Date
A min date
B min date
C min date

How can i do this using SQL in Access??

Jun 30 '06 #2

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

Similar topics

3
by: Robin Tucker | last post by:
Hi, Can anyone tell me how to select the "most recent" date values from a grouped query? Consider the following: CREATE TABLE . ( NOT NULL , NOT NULL , NOT NULL ) ON This is a...
3
by: RobG | last post by:
I would like a query that will tell me the minimum non-zero value in a row. Say I have a table with a column called recordID that contains unique record IDs, and have a set of values named V1,...
67
by: PC Datasheet | last post by:
Transaction data is given with date ranges: Beginning End 4/1/06 4/4/06 4/7/06 4/11/06 4/14/06 4/17/06 4/18/06 4/21/06 426/06 ...
11
bhcob1
by: bhcob1 | last post by:
Hi, Whenever I delete a record my command button, the record deletes, a list displaying all records is updated and then a message box appears: Microsoft Access can't find the field 'I' referred to...
3
by: samdev | last post by:
I have a table that contains records that provide the following info: vehicle type route # start time travel time end time I need to display info for all records in a query and/or report...
1
by: argniw | last post by:
I need a stored procedure or other method to find the maximum value for each set of records. I would want to eliminate all of the non- maximum records. An example of the data is below. For the...
1
by: aknoch | last post by:
My basic situation is this - I ONLY want duplicates, so the opposite of DISTINCT: I have two tables. Ordinarily, Table1ColumnA corresponds in a one to one ratio with Table2ColumnB through a...
6
by: Patrick Fisher | last post by:
Hi I have tables from 12 suppliers each of whom can supply the same part, I need to be able to create a table or query containing a list of suppliers who can supply at the lowest price for each...
0
by: rajesh | last post by:
Hi , i want to select the first minimum date in the column d for each distinct column a value. how i can do that in a sql query. xyztable Column a Column b Column c ...
0
by: taylorcarr | last post by:
A Canon printer is a smart device known for being advanced, efficient, and reliable. It is designed for home, office, and hybrid workspace use and can also be used for a variety of purposes. However,...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
by: ryjfgjl | last post by:
In our work, we often receive Excel tables with data in the same format. If we want to analyze these data, it can be difficult to analyze them because the data is spread across multiple Excel files...
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
0
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,...
0
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...

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.