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

any example for select statement with group by clause

Former Member
0 Likes
698

Hi experts,

Could any one give me the good example of select statement with group by clause(for ex:BSAK table).

reward guaranteed..

Kaki

1 ACCEPTED SOLUTION
Read only

Former Member
0 Likes
681

lets consider we have 3 fields in an database table :

MATNR, WERKS, KMENG.

Values are : 100, 1000, 50.00

100, 1001, 80.00

100, 1001, 60.00

101, 1005, 100.00.

Now i can use group by to get the average of quantities (MENGE) for a given material and plant.

Select MATNR WERKS AVG (MENGE)

into itab

from dtab

group by MATNR.

So itab contents are : 100, 1000, 50.00

100, 1001, 70.00

101, 1005, 100.00

Hope it was useful.

Hi experts,

Could any one give me the good example of select statement with group by clause(for ex:BSAK table).

reward guaranteed..

Kaki

4 REPLIES 4
Read only

Former Member
0 Likes
682

lets consider we have 3 fields in an database table :

MATNR, WERKS, KMENG.

Values are : 100, 1000, 50.00

100, 1001, 80.00

100, 1001, 60.00

101, 1005, 100.00.

Now i can use group by to get the average of quantities (MENGE) for a given material and plant.

Select MATNR WERKS AVG (MENGE)

into itab

from dtab

group by MATNR.

So itab contents are : 100, 1000, 50.00

100, 1001, 70.00

101, 1005, 100.00

Hope it was useful.

Read only

0 Likes
681

Hi Sarath

Thanks for ur reply.

It is not showing radio buttons to award points.

Kaki

Read only

0 Likes
681

Reward points system is currently down. Please come back later and try to reward the helpful answer. Thanks.

Regards,

Rich Heilman

Read only

0 Likes
681

Ok Rich,

I wll do that.

Thanks

Kaki