Skip to Content
author's profile photo Former Member
Former Member

Order by & Group by

Hi

I need some help.

I hv a list of PO for a Plant with different release dates,I just need to display the 1st release date for each PO .

The query i had written is like :

SELECT ekkoebeln ekkobedat SUM( netwr ) ekkolifnr ekkowaers ekkobsart ekkowkurs ekpowerks cdhdrudate cdhdr~utime

INTO TABLE t_display FROM ( ( ekko JOIN ekpo ON ekkoebeln = ekpoebeln ) JOIN cdhdr ON ekkoebeln = cdhdrobjectid )

WHERE

ekko~bsart EQ s_doc AND

ekpo~werks IN s_plant AND

ekpo~loekz EQ space AND

ekko~frgke EQ 'R' AND

ekko~waers IN s_cur AND

cdhdr~udate IN s_date AND

cdhdr~tcode = 'ME29N'

GROUP BY ekkoebeln ekkobedat ekkolifnr ekkowaers ekkobsart ekkowkurs ekpowerks cdhdrudate cdhdr~utime.

Now the the probem is that PO can released,than can be changed in a day 2-3 times,released every time again. so i just need to display the PO relesed on very 1st time.SO this cab be done by sorting the udate,utime for table cdhdr.but i am unable to do. so plz any one can help me out.to how to do?As i am in trouble ,so plz help me out with the quries reguired.

if not clr wid the problem plz respond....

Regards

Vipin.

Add a comment
10|10000 characters needed characters exceeded

Assigned Tags

Related questions

3 Answers

  • Best Answer
    author's profile photo Former Member
    Former Member
    Posted on Oct 19, 2007 at 11:47 AM

    Sort t_display by udate utime.

    t_display1[]=t_display[]

    delete adjacent duplicates from t-diplay1 comparing ponum.

    now t_display1 will contain only the latest entries

    *reward if solved*

    Add a comment
    10|10000 characters needed characters exceeded

  • author's profile photo Former Member
    Former Member
    Posted on Oct 19, 2007 at 10:55 AM

    Hi Vipin,

    Sort the final internal table with udate,utime before displying the data in the output.

    <b>Reward for helpful answers</b>

    Satish

    Add a comment
    10|10000 characters needed characters exceeded

  • author's profile photo Former Member
    Former Member
    Posted on Oct 19, 2007 at 10:59 AM

    Do not use group by in select statement, it will increase load on database.

    please sort it after fetching data

    Add a comment
    10|10000 characters needed characters exceeded

Before answering

You should only submit an answer when you are proposing a solution to the poster's problem. If you want the poster to clarify the question or provide more information, please leave a comment instead, requesting additional details. When answering, please include specifics, such as step-by-step instructions, context for the solution, and links to useful resources. Also, please make sure that you answer complies with our Rules of Engagement.
You must be Logged in to submit an answer.

Up to 10 attachments (including images) can be used with a maximum of 1.0 MB each and 10.5 MB total.