Application Development 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: 

select and count from table

Former Member
0 Kudos

Hi,

I have table with project end pernr and i wont to count how much

employee i have for projects

e.g.

pernr        project

123         e0-111
565         e0-111
158         e0-111
145         e1-222
456         e1-222
665         e1-222
222         e1-222
222         e6-777

i wont to get:

e0-111 3

e1-222 4

e6-777 1

What is the best way to do that ?

Regards

1 ACCEPTED SOLUTION

Former Member
0 Kudos

Can you do the following:

Select project count(*) as cnt
from zmytable
group by project

5 REPLIES 5

Former Member
0 Kudos

Can you do the following:

Select project count(*) as cnt
from zmytable
group by project

0 Kudos

Hi jerry

i do like u tell and i get just the project in itab the pernr Colman is empty what i miss?

regards

0 Kudos

That's hard to say. Why don't you select project and pernr without the count and group by, and examine the data?

0 Kudos

Keep you internal table like this way


data : begin of itab occurs 0.
 data : project like zmytable-project.
 data : cnt   type i.
data : end of itab.

Select project count(*) as cnt
from zmytable
into table itab
group by project.

0 Kudos

Thanks