greatest value

D

Delsa_SCCD

How would the critera be wrote to get a greatest value? (Not greater than,
but just the greatest - I don't want to see any other entries)
 
J

Jeff Boyce

Change your query to a Totals query.

Use "Maximum".

Regards

Jeff Boyce
Microsoft Access MVP

--
Disclaimer: This author may have received products and services mentioned
in this post. Mention and/or description of a product or service herein
does not constitute endorsement thereof.

Any code or pseudocode included in this post is offered "as is", with no
guarantee as to suitability.

You can thank the FTC of the USA for making this disclaimer
possible/necessary.
 
L

Lynn Trapp

SELECT Field1, Field2, Field3
FROM YourTable
WHERE Field1 = (SELECT Max Field1
FROM YourTable);

Since you didn't post anything about your table, I'm just using generic
names here.
 
D

Duane Hookom

Also,
SELECT TOP 1 tblNoName.*
FROM tblNoName
ORDER BY tblNoName.fldNoName DESC;
 
D

Delsa_SCCD

well, that doesn't seem to be enough info to help me.... let me fill you in a
bit more. Access 2003, the current query looks like this: Field #1: Well ID,
Field #2: date, Field #3: Time. There are a handful of different times
recorded per day, per well id..... I need the query to show me just the
latest time per day, per well id. (there is also a number of dates entered
per well id)
 
V

vanderghast

GROUP over the wellID and the date (your first and your second fields), MAX
over the last field.


Vanderghast, Access MVP
 
D

Delsa_SCCD

k, now I get nothing when its run...... is there a way to show a screen shot
in these posts? that would probably help
GROUP over the wellID and the date (your first and your second fields), MAX
over the last field.

Vanderghast, Access MVP
well, that doesn't seem to be enough info to help me.... let me fill you
in a
[quoted text clipped - 17 lines]
 
J

John Spencer

Step by step
== Create a new query
== Add WellID, the Datefield, and the timeField to the list of fields
== Select View: Totals from the menu
== Change GROUP BY To Max under the TimeField

If that does not give you what you want then post back and tell us in more
detail what is missing or wrong with what that query returns.

John Spencer
Access MVP 2002-2005, 2007-2010
The Hilltop Institute
University of Maryland Baltimore County

Delsa_SCCD said:
k, now I get nothing when its run...... is there a way to show a screen shot
in these posts? that would probably help
GROUP over the wellID and the date (your first and your second fields), MAX
over the last field.

Vanderghast, Access MVP
well, that doesn't seem to be enough info to help me.... let me fill you
in a
[quoted text clipped - 17 lines]
than,
but just the greatest - I don't want to see any other entries)
 
V

vanderghast

In SQL view, you should have:



SELECT [Well ID], [date], MAX([Time])
FROM [tableNameHere]
GROUP BY [Well ID], [date]



where you use your real table name. I assumed the field names are Well ID,
date and Time.


If you prefer, open a new query in design view, bring your table. Click on
the Summation button (to get a new row, total, in the grid). Drag the field
Well ID in the grid, keep the proposed Group By. Add the field Date in the
grid, keep the Group By. Bring your field Time, change the proposed Group by
to Maximum.


Vanderghast, Access MVP



Delsa_SCCD said:
k, now I get nothing when its run...... is there a way to show a screen
shot
in these posts? that would probably help
GROUP over the wellID and the date (your first and your second fields),
MAX
over the last field.

Vanderghast, Access MVP
well, that doesn't seem to be enough info to help me.... let me fill you
in a
[quoted text clipped - 17 lines]
than,
but just the greatest - I don't want to see any other entries)
 
D

Delsa_SCCD

Success! Thank you!!!!!
In SQL view, you should have:

SELECT [Well ID], [date], MAX([Time])
FROM [tableNameHere]
GROUP BY [Well ID], [date]

where you use your real table name. I assumed the field names are Well ID,
date and Time.

If you prefer, open a new query in design view, bring your table. Click on
the Summation button (to get a new row, total, in the grid). Drag the field
Well ID in the grid, keep the proposed Group By. Add the field Date in the
grid, keep the Group By. Bring your field Time, change the proposed Group by
to Maximum.

Vanderghast, Access MVP
k, now I get nothing when its run...... is there a way to show a screen
shot
[quoted text clipped - 11 lines]
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top