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

how to display last record of same ID

102 64KB
Hello friends

I have a table having below fields.

DrawingId DrawingNumber Revision
111 555555 0
111 555555 1
111 555555 2
111 555555 3
111 555555 4

I want to display the Last Record through Query. Kindly guide me how to do it.
Thanks
irsmalik
May 13 '19 #1
2 1255
twinnyfo
3,653 Expert Mod 2GB
Expand|Select|Wrap|Line Numbers
  1. SELECT Max(Revision) AS Latest 
  2. FROM YourTableName 
  3. WHERE DrawingID = 111 AND DrawingNumber = 555555;
Hope this hepps!
May 13 '19 #2
NeoPa
32,556 Expert Mod 16PB
If we assume that [DrawingId] and [DrawingNumber] are matched (Unfortunately the question is too unclear with the sample data too limited to be sure.) then we'd need something like :
Expand|Select|Wrap|Line Numbers
  1. SELECT [DrawingId]
  2.      , [DrawingNumber]
  3.      , [Revision]
  4. FROM   [YourTable]
  5.        INNER JOIN
  6.        (SELECT   [DrawingId]
  7.                , Max([Revision]) AS [MaxRev]
  8.         FROM     [YourTable]
  9.         GROUP BY [DrawingId]) AS [sQ]
  10.   ON   [YourTable].[DrawingId]=[sQ].[DrawingId]
  11.  AND   [YourTable].[Revision]=[sQ].[MaxRev]
Obviously, if [DrawingId] and [DrawingNumber] are not matched, you'll have to handle those appropriately.
May 13 '19 #3

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

Similar topics

8
by: Dan Matthews | last post by:
Hey everybody, I have an 2000 Access database that stores job listings from potential employers for a school. I would like to be able to display the date on a webpage the last time the database...
10
by: Alain Guichaoua | last post by:
Good evening to all Here is my problem : I have a form with a subform. They are linked. When I open the form I would like the subform to reach its last record. I tried the method...
5
by: SalimShahzad | last post by:
dear gurus, can any one help me to how to store progrmatically last value in combo box. say i load access form. but in combo box the last value how it will come any ideas...as i need only...
4
by: Rico | last post by:
Hi All, Just wondering, in vb code, how to if the last record on a cascading form is the current record? Thanks!
3
LuiePL
by: LuiePL | last post by:
How can I go to the last record of database? I've been having problems after creating a new record, and trying to display it, but I don't know what primary ID it's given, so I dont know how to go the...
2
by: sheenaa | last post by:
Hi, I want to display the last recorded record in the database of SQL SERVER 2005. How can i display it with the select query in the grid view... The database contains the...
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...
1
by: gavm360 | last post by:
Hello, I have a subform that has a command button to move to the next record. If there are more records i would just like to move to the next record, When the last record is reached I would like...
1
LeighW
by: LeighW | last post by:
Hello, I used Allen Browne's method of assigning default values from the last record which is especially helpful when adding a new record to filtered records. Using his method I had to create a...
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:
If we have dozens or hundreds of excel to import into the database, if we use the excel import function provided by database editors such as navicat, it will be extremely tedious and time-consuming...
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
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
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...

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.