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

SQL Statement with min function

Former Member
0 Likes
874

hi,

i have 2 tables. one contains OBJ_NAME and TRKORR and the other contains AS4DATE and TRKORR.

In the first table are a lot of objects. One object is also named more than once.

That means:

1 Object has n TRKORR has 1 DATE. (For all the diffrents objects)

I need all the Objects with their MIN DATE.

At the end i should have every object once with it's min date.

If i didn't explain it good enough please ask me again.

Any Ideas for the Select Statement?

Regards,

Jan

1 ACCEPTED SOLUTION
Read only

Former Member
0 Likes
656

SELECT p~obj_name min( as4date )

  INTO CORRESPONDING FIELDS OF TABLE wa_obj_name

  FROM ( e070 AS c

         INNER JOIN e071 AS p ON p~trkorr   = c~trkorr )

  Where as4date <= dat_bis and as4date >= dat_von AND c~trfunction = tr_func

  GROUP BY p~obj_name.

so far this code worked.

3 REPLIES 3
Read only

Former Member
0 Likes
656

Found Solution. Sorry for the post.

Read only

0 Likes
656

Hi Jan,

no worries.

Why not finish this thread and post the actual solution you found as well?

That way everybody can get something out of it.

- Lars

Read only

Former Member
0 Likes
657

SELECT p~obj_name min( as4date )

  INTO CORRESPONDING FIELDS OF TABLE wa_obj_name

  FROM ( e070 AS c

         INNER JOIN e071 AS p ON p~trkorr   = c~trkorr )

  Where as4date <= dat_bis and as4date >= dat_von AND c~trfunction = tr_func

  GROUP BY p~obj_name.

so far this code worked.