Home » SQL & PL/SQL » SQL & PL/SQL » Group by help (merged)
Group by help (merged) [message #397931] Tue, 14 April 2009 10:38
world.apps
Messages: 70
Registered: January 2007
Location: Hyderabad
Member
Hi,

Could you please help me in below requirement.

Actually the query is to get from tables,the taxes are saved in different table,for each po line there are different taxes,so till now i have been joining the po_line_id to the tax table to get the line tax details from tax table.

Now the scenario is that if all the lines are having the same taxes then i am not able to group them.

Please check the below example.

**********For Example : Earlier Scenario********

PO Num - 100


--------------------------------------------------------------------------------

Line Num         Item    Qty     Price      Amount
      1              Apple    10        5              50
               Tax Name        Description
                     a                     a tax
                     b                     b tax


--------------------------------------------------------------------------------

Line Num        Item      Qty     Price      Amount
      2               Pen        5          5             25
              Tax Name         Description
                     a                      a tax
                     b                       b tax


--------------------------------------------------------------------------------

Line Num        Item      Qty    Price       Amount
     3              Mouse      2        50            100
                Tax Name       Description 
                     c                      c tax
                     d                      d tax


--------------------------------------------------------------------------------

Line Num        Item      Qty    Price       Amount
      4               Key         1        50              50
                 Tax Name       Description
                      e                       e tax


--------------------------------------------------------------------------------

Line Num        Item       Qty   Price       Amount
      5               Book       20     10            200
                  Tax Name       Description
                      c                      c tax
                      d                      d tax



********************Required Format********************


PO Num - 100


--------------------------------------------------------------------------------

Line Num        Item       Qty   Price       Amount
      1              Apple    10        5             50
      2               Pen        5        5             25

           Tax Name         Description
                     a                 a tax
                     b                 b tax

 


--------------------------------------------------------------------------------

Line Num        Item       Qty   Price       Amount
     3              Mouse       2       50            100
     5               Book       20      10            200

                  Tax Name       Description
                      c                      c tax
                      d                      d tax

 


--------------------------------------------------------------------------------

Line Num        Item       Qty   Price       Amount
      4               Key         1        50              50
                   Tax Name       Description
                      e                       e tax



We have attached the sql file for table creation and data insertion.

Please help us

Thanks in advance
Previous Topic: query required
Next Topic: Parse of PL/SQL package Spec
Goto Forum:
  


Current Time: Tue Feb 11 16:45:45 CST 2025