|
| |
|
|
dzirkelb1
Posts: 1433 Joined: 10/5/2004 From: Cedar Rapids, Iowa Status: offline
|
Help with a Query - 10/20/2009 12:24:33
I have a situation where I wish to grab the next record in a recordset, but only that record. I can't use math to add 1 to it and find out, as they can skip. It might be easier to show with an example: SELECT TOP 100 PERCENT [QUOTE #] AS Expr1, QteLineSerialNbr AS Expr2 FROM dbo.[QUOTES DETAIL] WHERE ([QUOTE #] = 288753) ORDER BY QteLineSerialNbr results: 9 11 13 14 15 18 22 23 24 So, lets say I want to grab the result 13 and 9, how do I do that? Do I have to place it into an array and grab it or is there an easier alternative?
|
|
|
|
dzirkelb1
Posts: 1433 Joined: 10/5/2004 From: Cedar Rapids, Iowa Status: offline
|
RE: Help with a Query - 10/23/2009 12:44:27
What I am doing is having a Next and Previous link for the database. However, it's a little different than normal as the autonumber can skip, sort of. Quote 123456 has the following line id's 1 2 3 5 6 8 Quote 234567 has teh following id's 4 7 9 10 the line id is an autonumber, but, you can add lines to a quote whenever you want...hence, the skipping. What I am currently doing is this: SELECT QteLineSerialNbr FROM [QUOTES DETAIL] WHERE (QteLineSerialNbr > "&intQteLineSerialNbr&")" Where the variable is the current qtelineserialnbr for that page. Then, I just do the following: if not rs.eof then intNextQteLineSerialNbr = rs("QteLineSerialNbr") end if And, opposite for previous. However, that query is pulling all results of the query...maybe I should do a MIN command with a having clause on the qtelineserialnbr?
|
|
New Messages |
No New Messages |
Hot Topic w/ New Messages |
Hot Topic w/o New Messages |
Locked w/ New Messages |
Locked w/o New Messages |
|
Post New Thread
Reply to Message
Post New Poll
Submit Vote
Delete My Own Post
Delete My Own Thread
Rate Posts
|
|
|