sudarshank2
New Member
- Joined
- Nov 1, 2015
- Messages
- 12
Hi,
I have a table in Access which contains sales total. I need only Top 2 Values in each column.
My input data is below:
[TABLE="width: 592"]
<colgroup><col span="8"></colgroup><tbody>[TR]
[TD]Prd_Code[/TD]
[TD]Prd_Desc[/TD]
[TD]Cat_Code[/TD]
[TD]Cat_Desc[/TD]
[TD]Q1_Sales[/TD]
[TD]Q2_Sales[/TD]
[TD]Q3_Sales[/TD]
[TD]Q4_Sales[/TD]
[/TR]
[TR]
[TD]111[/TD]
[TD]ABC[/TD]
[TD]11[/TD]
[TD]A[/TD]
[TD]12[/TD]
[TD]12[/TD]
[TD]87[/TD]
[TD]34[/TD]
[/TR]
[TR]
[TD]222[/TD]
[TD]DEF[/TD]
[TD]22[/TD]
[TD]B[/TD]
[TD]43[/TD]
[TD]56[/TD]
[TD]56[/TD]
[TD]56[/TD]
[/TR]
[TR]
[TD]333[/TD]
[TD]GHI[/TD]
[TD]33[/TD]
[TD]C[/TD]
[TD]45[/TD]
[TD]34[/TD]
[TD]67[/TD]
[TD]75[/TD]
[/TR]
[TR]
[TD]444[/TD]
[TD]JKL[/TD]
[TD]44[/TD]
[TD]D[/TD]
[TD]56[/TD]
[TD]67[/TD]
[TD]54[/TD]
[TD]78[/TD]
[/TR]
</tbody>[/TABLE]
My output data should be: (Top 2 Values in Each Column)
[TABLE="width: 592"]
<colgroup><col span="8"></colgroup><tbody>[TR]
[TD]Prd_Code[/TD]
[TD]Prd_Desc[/TD]
[TD]Cat_Code[/TD]
[TD]Cat_Desc[/TD]
[TD]Q1_Sales[/TD]
[TD]Q2_Sales[/TD]
[TD]Q3_Sales[/TD]
[TD]Q4_Sales[/TD]
[/TR]
[TR]
[TD]111[/TD]
[TD]ABC[/TD]
[TD]11[/TD]
[TD]A[/TD]
[TD] [/TD]
[TD] [/TD]
[TD]87[/TD]
[TD] [/TD]
[/TR]
[TR]
[TD]222[/TD]
[TD]DEF[/TD]
[TD]22[/TD]
[TD]B[/TD]
[TD] [/TD]
[TD]56[/TD]
[TD] [/TD]
[TD] [/TD]
[/TR]
[TR]
[TD]333[/TD]
[TD]GHI[/TD]
[TD]33[/TD]
[TD]C[/TD]
[TD]45[/TD]
[TD] [/TD]
[TD]67[/TD]
[TD]75[/TD]
[/TR]
[TR]
[TD]444[/TD]
[TD]JKL[/TD]
[TD]44[/TD]
[TD]D[/TD]
[TD]56[/TD]
[TD]67[/TD]
[TD] [/TD]
[TD]78[/TD]
[/TR]
</tbody>[/TABLE]
SQL Query or VBA both are fine for me.
Can somebody please help.
I have a table in Access which contains sales total. I need only Top 2 Values in each column.
My input data is below:
[TABLE="width: 592"]
<colgroup><col span="8"></colgroup><tbody>[TR]
[TD]Prd_Code[/TD]
[TD]Prd_Desc[/TD]
[TD]Cat_Code[/TD]
[TD]Cat_Desc[/TD]
[TD]Q1_Sales[/TD]
[TD]Q2_Sales[/TD]
[TD]Q3_Sales[/TD]
[TD]Q4_Sales[/TD]
[/TR]
[TR]
[TD]111[/TD]
[TD]ABC[/TD]
[TD]11[/TD]
[TD]A[/TD]
[TD]12[/TD]
[TD]12[/TD]
[TD]87[/TD]
[TD]34[/TD]
[/TR]
[TR]
[TD]222[/TD]
[TD]DEF[/TD]
[TD]22[/TD]
[TD]B[/TD]
[TD]43[/TD]
[TD]56[/TD]
[TD]56[/TD]
[TD]56[/TD]
[/TR]
[TR]
[TD]333[/TD]
[TD]GHI[/TD]
[TD]33[/TD]
[TD]C[/TD]
[TD]45[/TD]
[TD]34[/TD]
[TD]67[/TD]
[TD]75[/TD]
[/TR]
[TR]
[TD]444[/TD]
[TD]JKL[/TD]
[TD]44[/TD]
[TD]D[/TD]
[TD]56[/TD]
[TD]67[/TD]
[TD]54[/TD]
[TD]78[/TD]
[/TR]
</tbody>[/TABLE]
My output data should be: (Top 2 Values in Each Column)
[TABLE="width: 592"]
<colgroup><col span="8"></colgroup><tbody>[TR]
[TD]Prd_Code[/TD]
[TD]Prd_Desc[/TD]
[TD]Cat_Code[/TD]
[TD]Cat_Desc[/TD]
[TD]Q1_Sales[/TD]
[TD]Q2_Sales[/TD]
[TD]Q3_Sales[/TD]
[TD]Q4_Sales[/TD]
[/TR]
[TR]
[TD]111[/TD]
[TD]ABC[/TD]
[TD]11[/TD]
[TD]A[/TD]
[TD] [/TD]
[TD] [/TD]
[TD]87[/TD]
[TD] [/TD]
[/TR]
[TR]
[TD]222[/TD]
[TD]DEF[/TD]
[TD]22[/TD]
[TD]B[/TD]
[TD] [/TD]
[TD]56[/TD]
[TD] [/TD]
[TD] [/TD]
[/TR]
[TR]
[TD]333[/TD]
[TD]GHI[/TD]
[TD]33[/TD]
[TD]C[/TD]
[TD]45[/TD]
[TD] [/TD]
[TD]67[/TD]
[TD]75[/TD]
[/TR]
[TR]
[TD]444[/TD]
[TD]JKL[/TD]
[TD]44[/TD]
[TD]D[/TD]
[TD]56[/TD]
[TD]67[/TD]
[TD] [/TD]
[TD]78[/TD]
[/TR]
</tbody>[/TABLE]
SQL Query or VBA both are fine for me.
Can somebody please help.