SQL Return Next Line

Jake94

Registered User.
Local time
Yesterday, 23:58
Joined
Dec 28, 2006
Messages
15
How can I return only the next line in a table? In this example if the Task is "Pending" I only want to return the next line "Assigned/Reassigned".

ID Date Status Team Task Name
11040077127 8/23/11 1:38 PM Launched Fred
11040077127 8/23/11 1:55 PM Claimed Review Collateral Review Bob
11040077127 8/23/11 1:56 PM Pending Review Collateral Review Bob
11040077127 8/24/11 9:30 AM Assigned/Reassigned Review Collateral Review Bob
11040077127 8/24/11 2:28 PM StepComplete Review Collateral Review Jane
11040077127 8/24/11 3:38 PM Assigned/Reassigned QA Collateral QA Ralph
11040077127 8/24/11 4:08 PM Completed Penny
11040077127 8/24/11 4:08 PM StepComplete QA Collateral QA Penny
Thanks!
 
What do you mean by "next line in a table" next record? Where do you mention if a task is assigned/reassigned?

Sorry your post wasn't very clear to me
 
Thanks for the reply!

11040077127, 8/23/11 1:56 PM, Pending, Review, Collateral Review, Bob
11040077127, 8/24/11 9:30 AM, Assigned/Reassigned, Review, Collateral Review, Bob



Yes, I want to pull the next record time wise. Above is a subset of the data from my original post. At 1:56 this record was put in Pending. I want to query the table and in any instance the (Task) field is Pending I want to only pull in the next record which in this case is the Assigned/Reassigned the next morning at 9:30.

Is this possible?
 
SELECT TOP 1 * FROM table WHERE table.DATETIME > " & "'" DateTimeOfCurrentRecord & """ & ORDER BY DATETIME DESC

Will pull one record. You can tweak this if I have misunderstood the business problem.
 

Users who are viewing this thread

Back
Top Bottom