on 08-23-2007 1:54 PM
Hi,
How to read a last entry in a database table
Hi,
First get the data into an internal table, then
SORT the internal talbe in Descending order, then Read the table with INDEX 1 then you will get the last record
Regards
Sudheer
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
to get last record:
record with (key1 key2 key3) as the key fields in that order
select max ( key1 ) into l_key1 from table.
select max ( key2 ) into l_key2 from table where key1 = l_key1.
select max ( key3 ) into l_key3 from table where key1 = l_key1 and key2 = l_key2.
select single * into record from table where where key1 = l_key1 and key2 = l_key2 and key3 = l_key3.
Similar logic if searching by other index fields.
Andrew
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Hi,
1. Last means what ? It may mean,
the last entered, as per some date/time field in the table.
2. So its better to select all records first
in some internal table (for the same person number)
3. Then SORT ITAB field5 descending.
4. Read ITAB INDEX 1.
Regards,
Sankar
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
User | Count |
---|---|
85 | |
10 | |
10 | |
9 | |
6 | |
6 | |
6 | |
5 | |
4 | |
3 |
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.