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

select count problem

Hallow I doing a select statement for count but its not write I have a error what I doing wrong in this select

<b>SELECT orgeh COUNT( * ) AS orgeh

FROM pa0001

INTO TABLE count_itab

GROUP BY orgeh</b>

WHERE ( persg EQ '6' OR persg EQ '7' OR persg EQ '8' )

AND stell = 'A'

AND orgeh NE '00009999'

AND orgeh = 'Z'.

regards

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 Jan 10, 2007 at 09:02 AM

    1) remove as Orgeh

    2) use group by at end of ur where condition

    Add a comment
    10|10000 characters needed characters exceeded

  • Posted on Jan 10, 2007 at 08:58 AM

    Hi,

    Try this code and kindly reward points by clicking the star on the left of reply,if it helps.

    data : begin of count_itab,

    orgeh type pa0001-orgeh,

    count type i,

    end of count_itab.

    SELECT orgeh COUNT( * )

    FROM pa0001

    INTO TABLE count_itab

    WHERE ( persg EQ '6' OR persg EQ '7' OR persg EQ '8' )

    AND stell = 'A'

    AND orgeh NE '00009999'

    AND orgeh = 'Z'

    GROUP BY orgeh.

    Add a comment
    10|10000 characters needed characters exceeded

  • Posted on Jan 10, 2007 at 09:01 AM

    Hi,

    Try this

    SELECT orgeh COUNT( * ) 
    FROM pa0001
    INTO TABLE count_itab
    WHERE  persg IN ( '6' , '7' , '8'  )
    AND stell = 'A'
    AND orgeh NE '00009999'
    AND orgeh = 'Z'
    GROUP BY orgeh.

    Y u have specified two conditions for a single field?

    AND orgeh NE '00009999'

    AND orgeh = 'Z'

    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.