Application Development and Automation Discussions
Join the discussions or start your own on all things application development, including tools and APIs, programming models, and keeping your skills sharp.
cancel
Showing results for 
Search instead for 
Did you mean: 
Read only

Select single help

Former Member
0 Likes
529

Hi All,

i want to do select single and to get the data that is last updated

how can i get it?

for example:

i have entries on table :

employee last update and additional data

123 17:34:27

123 17:35:03

123 17:35:48

i want to get the row that last update ,row number 2 ,

how can i get it with select single statement?

Best Regards

Ricardo

1 ACCEPTED SOLUTION
Read only

faisalatsap
Active Contributor
0 Likes
502

Hi, Arona

Test the following Sample Code Hope will help you to solve out your problem,

SELECT SINGLE field1 field2 MAX(field3 ) as field3 " Field3 is Time Field Here
  into CORRESPONDING FIELDS OF it
  from TABLE_NAME
  GROUP BY field1 field2.

Regards,

Faisal

3 REPLIES 3
Read only

Former Member
0 Likes
502

Try this:

Select *

From Table

into itab

and emp = emp_no.

Sort Itab by update_time desc.

Read Table itab index 1.

Read only

faisalatsap
Active Contributor
0 Likes
503

Hi, Arona

Test the following Sample Code Hope will help you to solve out your problem,

SELECT SINGLE field1 field2 MAX(field3 ) as field3 " Field3 is Time Field Here
  into CORRESPONDING FIELDS OF it
  from TABLE_NAME
  GROUP BY field1 field2.

Regards,

Faisal

Read only

Former Member
0 Likes
502

Hi,

try this,

SELECT single field1
                        FROM <dbtable>
                        INTO lv_time
                        ORDERBY field1
                        DESCENDING.

field1 ---> would be the time field.

if you want for the particular employee, then do a slight change in the code,

SELECT single <field1>
                        FROM <dbtable>
                        INTO lv_time
                        WHERE pernr = emp_no
                        ORDERBY field1
                        DESCENDING.

Thanks,

Sakthi Sri.