Getting the next record

G

Guest

Hello,

I have a query that check a for a specific string in a column and return the entries that meet that criteria. However, how would I go getting if to return the next entry?

I have a table with many column (obviouly) like so:
ID Dwg ID Status
*****************************
1 111 On Hold
2 12 In Progress
3 143 On Hold
4 111 Released
5 3445 Released
6 45 Stoped

Right now my query has as a criteria "On Hold" and thus would return entry ID 1, however, I need it to return the value of the next entry for the same Dwg ID, in this case ID 4. How can I acheive this?

I really appreciate the help!

Daniel
 
H

Hoopie

SELECT *
FROM tablename
WHERE [Dwg ID] IN (SELECT [Dwg ID] FROM tablename WHERE
Status = 'On Hold')

That should get you all Dwg ID records for any "On Hold"
status.

-----Original Message-----
Hello,

I have a query that check a for a specific string in a
column and return the entries that meet that criteria.
However, how would I go getting if to return the next
entry?
I have a table with many column (obviouly) like so:
ID Dwg ID Status
*****************************
1 111 On Hold
2 12 In Progress
3 143 On Hold
4 111 Released
5 3445 Released
6 45 Stoped

Right now my query has as a criteria "On Hold" and thus
would return entry ID 1, however, I need it to return the
value of the next entry for the same Dwg ID, in this case
ID 4. How can I acheive this?
 
G

Guest

But won't this just retrieve the DWg ID where the status is on hold? I wish to retrieve the next entry in the database for that same Dwg ID number.

Daniel

Hoopie said:
SELECT *
FROM tablename
WHERE [Dwg ID] IN (SELECT [Dwg ID] FROM tablename WHERE
Status = 'On Hold')

That should get you all Dwg ID records for any "On Hold"
status.

-----Original Message-----
Hello,

I have a query that check a for a specific string in a
column and return the entries that meet that criteria.
However, how would I go getting if to return the next
entry?
I have a table with many column (obviouly) like so:
ID Dwg ID Status
*****************************
1 111 On Hold
2 12 In Progress
3 143 On Hold
4 111 Released
5 3445 Released
6 45 Stoped

Right now my query has as a criteria "On Hold" and thus
would return entry ID 1, however, I need it to return the
value of the next entry for the same Dwg ID, in this case
ID 4. How can I acheive this?
I really appreciate the help!

Daniel
.
 
H

Hoopie

The subquery [(SELECT [Dwg ID] FROM tablename WHERE Status
= 'On Hold')] selects a list of Dwg IDs with orders on
hold. The main query doesn't care about hold status. It
returns all orders with Dwg IDs that are in the subquery
list.
-----Original Message-----
But won't this just retrieve the DWg ID where the status
is on hold? I wish to retrieve the next entry in the
database for that same Dwg ID number.
Daniel

Hoopie said:
SELECT *
FROM tablename
WHERE [Dwg ID] IN (SELECT [Dwg ID] FROM tablename WHERE
Status = 'On Hold')

That should get you all Dwg ID records for any "On Hold"
status.

-----Original Message-----
Hello,

I have a query that check a for a specific string in a
column and return the entries that meet that criteria.
However, how would I go getting if to return the next
entry?
I have a table with many column (obviouly) like so:
ID Dwg ID Status
*****************************
1 111 On Hold
2 12 In Progress
3 143 On Hold
4 111 Released
5 3445 Released
6 45 Stoped

Right now my query has as a criteria "On Hold" and
thus
would return entry ID 1, however, I need it to return the
value of the next entry for the same Dwg ID, in this case
ID 4. How can I acheive this?
I really appreciate the help!

Daniel
.
.
 
G

Guest

Hoopie,

This query return both the original recordset as well as the next entry. How would I only get the next entry? I do not want to see the recordset that triggered the query

Daniel




Daniel said:
Hoopie,

I don't quite understand it BUT you were right it does seem to work.

Thank you for your help,

Daniel




Hoopie said:
The subquery [(SELECT [Dwg ID] FROM tablename WHERE Status
= 'On Hold')] selects a list of Dwg IDs with orders on
hold. The main query doesn't care about hold status. It
returns all orders with Dwg IDs that are in the subquery
list.
-----Original Message-----
But won't this just retrieve the DWg ID where the status
is on hold? I wish to retrieve the next entry in the
database for that same Dwg ID number.
Daniel

:

SELECT *
FROM tablename
WHERE [Dwg ID] IN (SELECT [Dwg ID] FROM tablename WHERE
Status = 'On Hold')

That should get you all Dwg ID records for any "On Hold"
status.


-----Original Message-----
Hello,

I have a query that check a for a specific string in a
column and return the entries that meet that criteria.
However, how would I go getting if to return the next
entry?

I have a table with many column (obviouly) like so:
ID Dwg ID Status
*****************************
1 111 On Hold
2 12 In Progress
3 143 On Hold
4 111 Released
5 3445 Released
6 45 Stoped

Right now my query has as a criteria "On Hold" and thus
would return entry ID 1, however, I need it to return the
value of the next entry for the same Dwg ID, in this case
ID 4. How can I acheive this?

I really appreciate the help!

Daniel
.


.
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top