Wrox Programmer Forums
|
Classic ASP Databases Discuss using ASP 3 to work with data in databases, including ASP Database Setup issues from the old P2P forum on this specific subtopic. See also the book forum Beginning ASP.NET Databases for questions specific to that book. NOT for ASP.NET 1.0, 1.1, or 2.0.
Welcome to the p2p.wrox.com Forums.

You are currently viewing the Classic ASP Databases section of the Wrox Programmer to Programmer discussions. This is a community of software programmers and website developers including Wrox book authors and readers. New member registration was closed in 2019. New posts were shut off and the site was archived into this static format as of October 1, 2020. If you require technical support for a Wrox book please contact http://hub.wiley.com
 
Old May 15th, 2005, 05:44 AM
SKE SKE is offline
Authorized User
 
Join Date: Mar 2005
Posts: 18
Thanks: 0
Thanked 0 Times in 0 Posts
Default How to open only the record with highest ID ?!

Hello.
I need to tell my script to open a Database and to read stored informations only from the record with the highest ID. Example: I have 7 records whose ID go from 1 to 7, I need to open only the last one (ID7). How can I do this ?!

THANKS

 
Old May 15th, 2005, 06:21 AM
Friend of Wrox
 
Join Date: May 2004
Posts: 642
Thanks: 0
Thanked 43 Times in 42 Posts
Default

Following are some of the possible ways:

1. select * from your_table where Id = (select max(ID) from your_table)

2. select top 1* from your_table order by ID desc



Om Prakash
 
Old May 16th, 2005, 06:05 AM
SKE SKE is offline
Authorized User
 
Join Date: Mar 2005
Posts: 18
Thanks: 0
Thanked 0 Times in 0 Posts
Default

As usual , thanks so much Mr.Prakash !






Similar Threads
Thread Thread Starter Forum Replies Last Post
get last record id using mySQL GregH Classic ASP Databases 6 May 11th, 2008 08:29 PM
Last record inserted ID ADAC Programming VB Databases Basics 1 June 5th, 2006 02:41 PM
Capture USER ID in record fixitman Access 3 February 9th, 2005 03:56 PM
Record ID sinner Classic ASP Databases 12 February 28th, 2004 03:36 PM
Insert new record ID levinho Classic ASP Databases 5 January 14th, 2004 12:03 PM





Powered by vBulletin®
Copyright ©2000 - 2020, Jelsoft Enterprises Ltd.
Copyright (c) 2020 John Wiley & Sons, Inc.