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 count problem

Former Member
0 Likes
599

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

1 ACCEPTED SOLUTION
Read only

Former Member
0 Likes
569

1) remove as Orgeh

2) use group by at end of ur where condition

3 REPLIES 3
Read only

jayanthi_jayaraman
Active Contributor
0 Likes
569

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.

Read only

Former Member
0 Likes
569

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'

Read only

Former Member
0 Likes
570

1) remove as Orgeh

2) use group by at end of ur where condition