Solved

How to get the next record available?

Posted on 2014-11-12
4
134 Views
Last Modified: 2014-11-13
Hi,

On my page I have the applicationID passed and based on it the page information is loading.

<cfif isDefined("url.AppID")>
	<cfset AID = #url.AppID#>
<cfelse>
	<cfset AID = 1>
</cfif>

Open in new window


I have created two buttons for the next record and previous record

<input type="button" name="PreviousBtn" value="Previous">
<input type="button" name="NextBtn" value="   Next   ">

Open in new window


I just want to know how in SQL can get the next record based on the applicationID that is passed

exp:
AppID
7
55
58
60
61
62
70


so, if the url.AppID passed is 58 then when the user click on next I should take the user to record 60


here is the SQL that I need help with:

<cfquery name="AppInformation" datasource="#dsn#" username="#dbID#" password="#dbPassword#">

SELECT ApplicationID
FROM AppRepository
where ApplicationID = #AID# plus "the next record available" 

</cfquery>

Open in new window

0
Comment
Question by:lulu50
  • 2
4 Comments
 
LVL 13

Accepted Solution

by:
Philip Pinnell earned 500 total points
ID: 40437638
SELECT top 1 ApplicationID
FROM AppRepository
where ApplicationID > #AID#
order by ApplicationID
0
 
LVL 32

Expert Comment

by:awking00
ID: 40437960
select min(ApplicationID)
from AppRepository
where ApplicationID > #AID#
0
 

Author Closing Comment

by:lulu50
ID: 40440024
Thank you
0
 
LVL 13

Expert Comment

by:Philip Pinnell
ID: 40440195
Thanks
0

Featured Post

Guide to Performance: Optimization & Monitoring

Nowadays, monitoring is a mixture of tools, systems, and codes—making it a very complex process. And with this complexity, comes variables for failure. Get DZone’s new Guide to Performance to learn how to proactively find these variables and solve them before a disruption occurs.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

In this article I will describe the Backup & Restore method as one possible migration process and I will add the extra tasks needed for an upgrade when and where is applied so it will cover all.
In this article we will get to know that how can we recover deleted data if it happens accidently. We really can recover deleted rows if we know the time when data is deleted by using the transaction log.
Attackers love to prey on accounts that have privileges. Reducing privileged accounts and protecting privileged accounts therefore is paramount. Users, groups, and service accounts need to be protected to help protect the entire Active Directory …

726 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question