You are viewing a plain text version of this content. The canonical link for it is here.
Posted to user-java@ibatis.apache.org by "Baresel, Christoph" <Ch...@de.soliver.com> on 2006/10/24 11:13:41 UTC

Summation in more than one group levels

I want to get a summation for some fields in a result-set
over more than one group level. I have no Olap-Functions on the
DB-Server ( iSeries V5R3 ),
so I have to do it with Java. 

Is there a possibility to do it with ibatis-SQL-Map?

e.g.: 
select sum(pieces), company, customer  from mytable group by
company, customer
order by company, customer

I want to get a list with Objects from Ibatis with the following data:
 pieces     CompanyId     customerId     isSum
        1	    	A		1	no
        1	    	A		1	no
        1	    	A		1	no
        3    	A		1	yes

        1	    	A		2	no
        1		A		2	no
        2		A             	2	yes

        5		A             		yes


        1	    	B		1	no
        1	    	B		1	no
        1	    	B		1	no
        3    	B		1	yes

        1	    	B		2	no
        1		B		2	no
        2		B             	2	yes

        5		B             		yes

Any idea??

Christoph 

Re: Summation in more than one group levels

Posted by Larry Meadors <lm...@apache.org>.
iSeries... *shudder*

 ;-)

Use a RowHandler.

Larry


On 10/24/06, Baresel, Christoph <Ch...@de.soliver.com> wrote:
>
>
>
> I want to get a summation for some fields in a result-set
> over more than one group level. I have no Olap-Functions on the DB-Server (
> iSeries V5R3 ),
> so I have to do it with Java.
>
> Is there a possibility to do it with ibatis-SQL-Map?
>
> e.g.:
> select sum(pieces), company, customer  from mytable group by
> company, customer
> order by company, customer
>
> I want to get a list with Objects from Ibatis with the following data:
>  pieces     CompanyId     customerId     isSum
>         1               A               1       no
>         1               A               1       no
>         1               A               1       no
>         3       A               1       yes
>
>         1               A               2       no
>         1               A               2       no
>         2               A               2       yes
>
>         5               A                       yes
>
>
>         1               B               1       no
>         1               B               1       no
>         1               B               1       no
>         3       B               1       yes
>
>         1               B               2       no
>         1               B               2       no
>         2               B               2       yes
>
>         5               B                       yes
>
> Any idea??
>
> Christoph