Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people, just like you, are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
Solved

How to get the next record available?

Posted on 2014-11-12
4
133 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

Free Tool: Port Scanner

Check which ports are open to the outside world. Helps make sure that your firewall rules are working as intended.

One of a set of tools we are providing to everyone as a way of saying thank you for being a part of the community.

Question has a verified solution.

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

Suggested Solutions

Title # Comments Views Activity
Master DB with Masterkey 1 34
How to count the days a record spends in a step 21 51
SQL Use Distinct with two fields 3 14
TSQL convert date to string 4 35
Occasionally there is a need to clean table columns, especially if you have inherited legacy data. There are obviously many ways to accomplish that, including elaborate UPDATE queries with anywhere from one to numerous REPLACE functions (even within…
Composite queries are used to retrieve the results from joining multiple queries after applying any filters. UNION, INTERSECT, MINUS, and UNION ALL are some of the operators used to get certain desired results.​
Microsoft Active Directory, the widely used IT infrastructure, is known for its high risk of credential theft. The best way to test your Active Directory’s vulnerabilities to pass-the-ticket, pass-the-hash, privilege escalation, and malware attacks …
A short tutorial showing how to set up an email signature in Outlook on the Web (previously known as OWA). For free email signatures designs, visit https://www.mail-signatures.com/articles/signature-templates/?sts=6651 If you want to manage em…

828 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