Re: Add the sql record having same field.

2016-03-06 Thread Jacek Laskowski
What about sum?

Jacek
06.03.2016 7:28 AM "Angel Angel"  napisaƂ(a):

> Hello,
> I have one table and 2 fields in it
> 1) item_id and
> 2) count
>
>
>
> i want to add the count field as per item (means group the item_ids)
>
> example
> Input
> itea_ID Count
> 500 2
> 200 6
> 500 4
> 100 3
> 200 6
>
>
> Required Output
>
> Result
> Itea_id Count
> 500 6
> 200 12
> 100 3
>
>
> I used the command the  Resut= Input.groupBy(Item_ID).count()
> output is
>
> 500   2
> 200   2
> 1001
>
> so how can i get the above output?
>
> Thnaks
>


Add the sql record having same field.

2016-03-05 Thread Angel Angel
Hello,
I have one table and 2 fields in it
1) item_id and
2) count



i want to add the count field as per item (means group the item_ids)

example
Input
itea_ID Count
500 2
200 6
500 4
100 3
200 6


Required Output

Result
Itea_id Count
500 6
200 12
100 3


I used the command the  Resut= Input.groupBy(Item_ID).count()
output is

500   2
200   2
1001

so how can i get the above output?

Thnaks