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 and count from table

Former Member
0 Likes
793

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
Read only

Former Member
0 Likes
753

Can you do the following:

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

5 REPLIES 5
Read only

Former Member
0 Likes
754

Can you do the following:

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

Read only

0 Likes
753

Hi jerry

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

regards

Read only

0 Likes
753

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

Read only

0 Likes
753

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.

a®

Read only

0 Likes
753

Thanks