View previous topic :: View next topic
|
Author |
Message |
abdulrafi
Active User
Joined: 14 Sep 2009 Posts: 184 Location: Coimbatore
|
|
|
|
Hi,
I need a help.
I have several entries in my DB2 table like,
10 STATUS1
10 STATUS2
10 STATUS3
10 STATUS4
I need to read the current entry from the DB2 table. According to my example it is STATUS4, if in this case I need to fetch the previous of that from the table ie) STATUS3 needs to be fetched.
Could you please help me on how this could be done??? |
|
Back to top |
|
|
Akatsukami
Global Moderator
Joined: 03 Oct 2009 Posts: 1788 Location: Bloomington, IL
|
|
|
|
You recognize that "the previous" is undefined (as well as bad English) unless the SELECT includes an ORDER BY clause, yes? |
|
Back to top |
|
|
Pandora-Box
Global Moderator
Joined: 07 Sep 2006 Posts: 1592 Location: Andromeda Galaxy
|
|
|
|
You need to explain the significance of statuses indirectly atleast so someone can assist |
|
Back to top |
|
|
dick scherrer
Moderator Emeritus
Joined: 23 Nov 2006 Posts: 19244 Location: Inside the Matrix
|
|
|
|
Hello,
How does one know that STATUS4 is "current"?
Do the rows contain a date/time stamp?
What if STATUS3 was deleted and then re-inserted - is this now "current"? |
|
Back to top |
|
|
abdulrafi
Active User
Joined: 14 Sep 2009 Posts: 184 Location: Coimbatore
|
|
|
|
Even though I use the SELECT with ORDER BY i could arrange them in an ASC or DSC, but how could I get the last previous exactly from my DB2 table :-(
Also as you asked the significance of status field, using this status field there are going to be some online process and DB2 table updation.
Please let me know if you need any more information... |
|
Back to top |
|
|
enrico-sorichetti
Superior Member
Joined: 14 Mar 2007 Posts: 10873 Location: italy
|
|
|
|
Quote: |
Please let me know if you need any more information... |
describe the logic to determine the current entry |
|
Back to top |
|
|
dick scherrer
Moderator Emeritus
Joined: 23 Nov 2006 Posts: 19244 Location: Inside the Matrix
|
|
|
|
Hello,
Quote: |
but how could I get the last previous exactly from my DB2 table |
I suspect, You will need to include "something" in the design of the table to support "most current". |
|
Back to top |
|
|
|