‎2007 Feb 14 5:00 AM
Hi All,
I have a issue regarding date.
I have 3 fields in my D.B.Table
<b>Field1, Field2 and DATE</b> Fields.
Now with select query i want to retrieve Field1 & Field2 For Latest Date in DATE field!
Can anybody give solution!
Thanks in advance.
Thanks,
Deep.
‎2007 Feb 14 5:05 AM
Use this code.
select single fld1 fld2 from <table>
into (v_fld1, v_fld2)
where date eq ( select max( date ) from <table> ).
or
select single fld1 fld2 from <table>
into table gt_fields
where date eq ( select max( date ) from <table> ).
‎2007 Feb 14 5:05 AM
Use this code.
select single fld1 fld2 from <table>
into (v_fld1, v_fld2)
where date eq ( select max( date ) from <table> ).
or
select single fld1 fld2 from <table>
into table gt_fields
where date eq ( select max( date ) from <table> ).
‎2007 Feb 14 5:18 AM
Hi Manoj,
I can use another condition NAME EQ '' in where condition right!
Thanks,
Deep.
‎2007 Feb 14 5:20 AM
Yes. you can.
select fld1 fld2
....
where date eq ( select max( date ) ... )
and name eq p_name.
‎2007 Feb 14 5:07 AM
hi,
1 . fetch all the records into an itab.
2. sort that itab by date
3. so the latest record will come in top.
4. take Field1, Field2 from that.
Regards
anver
‎2007 Feb 14 5:20 AM
Select date field1 field2
from xxxx
into table itab.
if sy-subrc = 0.
sort itab descending by date.
Read itab with key index 1.
endif.