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

select from a table the highest revision number

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 for each item
is. How do I do this?

Jan 31 '06 #1
4 4869
jo***@graham.ca wrote:
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 for each item
is. How do I do this?

Unknown. Do you want to extract the highest revision number for all
items? Do you want to extract the the highest revision number for a
particular item?

It appears you want to return 1-many rows. Why not use a totals query?

Jan 31 '06 #2
I would like to return all of the items with the highest revision
numbers.
ItemNum rev
dwg-123 01
dwg-123 02
dwg-234 01
dwg-345 01
dwg-345 02
dwg-345 03

I only want dwg 123 rev02, dwg-234 rev01, and dwg-345 rev03.
I don't know how many revisions per drawing or what the highest
revision might be.
salad wrote:
jo***@graham.ca wrote:
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 for each item
is. How do I do this?

Unknown. Do you want to extract the highest revision number for all
items? Do you want to extract the the highest revision number for a
particular item?

It appears you want to return 1-many rows. Why not use a totals query?


Jan 31 '06 #3
asc4john wrote:
I would like to return all of the items with the highest revision
numbers.
ItemNum rev
dwg-123 01
dwg-123 02
dwg-234 01
dwg-345 01
dwg-345 02
dwg-345 03

I only want dwg 123 rev02, dwg-234 rev01, and dwg-345 rev03.
I don't know how many revisions per drawing or what the highest
revision might be.
salad wrote:
jo***@graham.ca wrote:

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 for each item
is. How do I do this?


Unknown. Do you want to extract the highest revision number for all
items? Do you want to extract the the highest revision number for a
particular item?

It appears you want to return 1-many rows. Why not use a totals query?


Dmax and others aggregate functions only return 1 record. That is why I
mentioned a Totals Query.

If you know the item #, you can get the highest revision using DMax.

If you want to return a series of items and their revision numbers then
Create a query/new and select the table
Drag the two fields, Item and Revision to the columns.
Click View/Totals from the menu bar
Put GroupBy under Item
Select Max under Revision.
Save query and run to view results.

You can use this query to select records in a combo/list box or you can
use if to find records in the recordset.

Jan 31 '06 #4
jo***@graham.ca wrote in
news:11**********************@g47g2000cwa.googlegr oups.com:
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 for each item is. How do I do this?

This requires a subquery, to select the max() of revision from each
Item.

select item, revision from table where revision IN (SELECT max
(revision) from table where ITEM = [ITEM])

Or you can use the Dmax() function:
SELECT Item, revision FROM table WHERE
revision = dmax("revision","table","Item = '" & [item] & "'")

This may prove too slow, so you can instead make a permanent totals
query that groups by the item,and the max(revision) and do an inner
join back to the main table in a second query.

--
Bob Quintal

PA is y I've altered my email address.
Feb 1 '06 #5

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

Similar topics

2
by: yankee | last post by:
Hi all, I have the following HTML code: <form> <table border=1 cellspacing=0 cellpadding=3> <tr> <td>Select a Document:</td> <td><SELECT name="type" id="type"> <OPTION
2
by: PMB | last post by:
Thank you in advance for any and all assistance. I'm trying to keep my numbers for transactions sequential. I clear my monthly transactions each month and store them in a general transactions...
3
by: William Wisnieski | last post by:
Hello Again, I'm really stuck on this one.....so I'm going to try a different approach to this problem. I have a query by form that returns a record set in a datasheet. The user double...
11
by: Neo Geshel | last post by:
I have an Access DB, from which I am going to pull images. Each image has an associated ID, but the ID's are not necessarily sequential (some images may have been deleted, leaving gaps in the list...
4
by: Richard | last post by:
In a manufacturing document control situation, a procedure revision table named has principal columns and and satellite data columns , , . A unique index and to ensure each procedure name has...
1
by: =?Utf-8?B?QmFkaXM=?= | last post by:
Hi, In my table I have a column called ID that contain values such as A1,A2,AA1,AG3...AU and I would like to select the maximum value in the values that start with A followed by number in this...
3
by: ncsthbell | last post by:
I am trying to run a query in access using the 'max' function. For example, I have many rows of data, one for each state and each state has a column for 'Miles'. I want to get the highest number of...
4
by: perhapscwk | last post by:
Sample tables (company_id RK companies.id): Companies id company 1 … 2 … 3 … Locations id company_id location revision
6
by: linzeyd | last post by:
I have a problem that's driving me crazy. i have a table that is a series of things like this (Unit type) (part description) (count) IWU High pressure flowmeter 3 IWU Transformer ...
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...
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
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
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
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,...
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
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.