473,407 Members | 2,326 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,407 software developers and data experts.

Highest Record?

I have another table with (no id), shipnumber, name of ship, date of
activation ship

Example : 123456 , APOLLO , 01-01-2003
222222 , ZEUS , 01-02-2003
333333 , DIANE 2, 06-06-2003
123456 , MONTOYE V , 06-02-2004

I would like a query that shows me every ship number once and every
ship name once based on the latest date. So in case of 123456 that
would be Montoye V.
But i don't find it.

TX anyone, anywhere, anyway, anyhow, anytime.
Nov 12 '05 #1
3 1454
SELECT ShipNumber, ShipName, Max([DateField]) AS LastDate FROM TableName
GROUP BY ShipNumber, ShipName

--
Brendan Reynolds
"Peter D" <da*********@pandora.be> wrote in message
news:2f*************************@posting.google.co m...
I have another table with (no id), shipnumber, name of ship, date of
activation ship

Example : 123456 , APOLLO , 01-01-2003
222222 , ZEUS , 01-02-2003
333333 , DIANE 2, 06-06-2003
123456 , MONTOYE V , 06-02-2004

I would like a query that shows me every ship number once and every
ship name once based on the latest date. So in case of 123456 that
would be Montoye V.
But i don't find it.

TX anyone, anywhere, anyway, anyhow, anytime.

Nov 12 '05 #2
Turn on Totals, Set group by on all fields except Date, for this one use
Max. Should return the most recent date for each record "group".

Mike Storr
www.veraccess.com
"Peter D" <da*********@pandora.be> wrote in message
news:2f*************************@posting.google.co m...
I have another table with (no id), shipnumber, name of ship, date of
activation ship

Example : 123456 , APOLLO , 01-01-2003
222222 , ZEUS , 01-02-2003
333333 , DIANE 2, 06-06-2003
123456 , MONTOYE V , 06-02-2004

I would like a query that shows me every ship number once and every
ship name once based on the latest date. So in case of 123456 that
would be Montoye V.
But i don't find it.

TX anyone, anywhere, anyway, anyhow, anytime.

Nov 12 '05 #3
try this,
You will need to query's:

Query 1:

SELECT ur_table_name.shipnumber, Max(ur_table_name.[date of activation
ship]) AS [date of activation ship]
FROM ur_table_name
GROUP BY ur_table_name.shipnumber;

Query 2:

SELECT Query1.shipnumber, ur_table_name.[name of ship], Query1.[date of
activation ship]
FROM ur_table_name INNER JOIN Query1 ON (ur_table_name.[date of activation
ship] = Query1.[date of activation ship]) AND (ur_table_name.shipnumber =
Query1.shipnumber);
Mark

"Peter D" <da*********@pandora.be> wrote in message
news:2f*************************@posting.google.co m...
I have another table with (no id), shipnumber, name of ship, date of
activation ship

Example : 123456 , APOLLO , 01-01-2003
222222 , ZEUS , 01-02-2003
333333 , DIANE 2, 06-06-2003
123456 , MONTOYE V , 06-02-2004

I would like a query that shows me every ship number once and every
ship name once based on the latest date. So in case of 123456 that
would be Montoye V.
But i don't find it.

TX anyone, anywhere, anyway, anyhow, anytime.
Nov 12 '05 #4

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

Similar topics

13
by: shank | last post by:
How do you return the highest value in a recordset of maybe 100 records? Is it necessary to run 2 recordsets? I was hoping it was as simple as Max(), but no luck. thanks
4
by: Robert Oschler | last post by:
I have a MySQL table on my web server (external web host) that has an auto-increment integer as it's primary key field. Is there a quick PHP function that will get me the highest ID in the table,...
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...
4
by: johnk | last post by:
I have a table of items, with revision numbers. I need to extract the items with highest revision number. The items may be listed several times and I don't know what the highest revision number...
5
by: tess | last post by:
What I need is to find out brand preference per customer. I have records showing how many of each brand they have purchased in the last 5 years. I can easily create a crosstab query that will...
1
by: Dixie | last post by:
I want to append a number of records onto an existing table. Each record will have an ID number (it is not an autonumber as it is too variable). It is currently set as an integer field. I want...
1
by: Coll | last post by:
Hi - I'm trying to figure out how to append a record to a table and then open a form and display that record. My thought was to use the autonum primary key field (recordnum) and display the highest...
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: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
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: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
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...
0
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...
0
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...
0
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...
0
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,...

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.