Guest_imported
New member
- Jan 1, 1970
- 0
I have the following table:
ID Year Quarter1 Quarter2 Quarter3 Quarter4
--------------------------------------------------------
A1 2000 50 80 120 160
A2 2000 120 70 160 180
A3 2000 80 65 190 220
A1 2001 150 80 220 250
ID & Year is the primary key. Quarter1,Quarter2, Quarter3 & Quarter4 indicate how much the person(ID) spent within the quarter. I want to calculate the query result in such:
Q=Quarter
Spending/Year 2000/Q1 2000/Q2 2000/Q3 2000/Q4
----------------------------------------------------
<50 0 0 0 0
50-100 2 3 0 0
101-150 1 0 1 0
151-200 0 0 2 2
>200 0 0 0 1
ID Year Quarter1 Quarter2 Quarter3 Quarter4
--------------------------------------------------------
A1 2000 50 80 120 160
A2 2000 120 70 160 180
A3 2000 80 65 190 220
A1 2001 150 80 220 250
ID & Year is the primary key. Quarter1,Quarter2, Quarter3 & Quarter4 indicate how much the person(ID) spent within the quarter. I want to calculate the query result in such:
Q=Quarter
Spending/Year 2000/Q1 2000/Q2 2000/Q3 2000/Q4
----------------------------------------------------
<50 0 0 0 0
50-100 2 3 0 0
101-150 1 0 1 0
151-200 0 0 2 2
>200 0 0 0 1