Skip to Content
avatar image
Former Member

Grouping

Hi

Is it possible to display total group wise through Query Generator. For e.g

B.P A 1000

A 2000

3000

B.P B 2000

B 4000

6000

Total 9000

Thanks

Add comment
10|10000 characters needed characters exceeded

  • Get RSS Feed

4 Answers

  • Best Answer
    avatar image
    Former Member
    Jun 27, 2010 at 05:34 PM

    HI Manish......

    You can do it only by applying Union Join and mention the Table Name.....

    Regards,

    Rahul

    Add comment
    10|10000 characters needed characters exceeded

  • Jun 28, 2010 at 09:12 AM

    Try something like this:

    SELECT grouping(T0.Cardcode),grouping (T0.DocNum),
    case grouping(T0.Cardcode)
     when 0 then min(T0.CardCode)
     else '' end,
    case when grouping (T0.DocNum)=0
     and  grouping(T0.Cardcode)=0
     then  min(T0.docNum)
     else '' end,
     SUM(T0.DocTotal)
     FROM OINV T0
    Group BY T0.CardCode,T0.DocNum with rollup

    Add comment
    10|10000 characters needed characters exceeded

  • avatar image
    Former Member
    Jun 27, 2010 at 04:00 PM

    Hi,

    It is possible for the total lines by using UNION ALL.

    Something like:

    SELECT T0.CardCode, T0.DocTotal FROM dbo.OINV T0

    UNION ALL

    SELECT T0.CardCode + ' Total', SUM(T0.DocTotal) FROM dbo.OINV T0

    Group BY T0.CardCode

    Order BY T0.CardCode

    Add comment
    10|10000 characters needed characters exceeded

  • avatar image
    Former Member
    Jun 28, 2010 at 03:32 PM

    Closed.

    Add comment
    10|10000 characters needed characters exceeded