Hi,
I have the following query and would like to be able to control the pivot statement through two parameters. Tentatively, I have put 1 and 21 for testing purposes and would like to replace it with variables once I got it working.
[FONT="]TRANSFORM Nz(Count(Case_ID),0) AS CountOfCase_ID[/FONT]
[FONT="]SELECT stag_SGP.OB[/FONT]
[FONT="]FROM stag_SGP[/FONT]
[FONT="]WHERE (((stag_SGP.rWeek) Between 1 And 21) And (([/FONT][FONT="]stag_SGP[/FONT][FONT="].REQUEST_STATUS)="Good") And (([/FONT][FONT="]stag_SGP[/FONT][FONT="].ReqYear)=2009) And [/FONT][FONT="]stag_SGP[/FONT][FONT="].OB IN ('FAIL','PASS'))[/FONT]
[FONT="]GROUP BY [/FONT][FONT="]stag_SGP[/FONT][FONT="].BGrp, [/FONT][FONT="]stag_SGP[/FONT][FONT="].PRIORITY, [/FONT][FONT="]stag_SGP[/FONT][FONT="].OB[/FONT]
[FONT="]PIVOT [/FONT][FONT="]stag_SGP[/FONT][FONT="].rWeek IN ([/FONT][FONT="]stag_SGP[/FONT][FONT="].rWeek >= 1 AND [/FONT][FONT="]stag_SGP[/FONT][FONT="].rWeek <= 21) ;[/FONT]
[FONT="][/FONT]
[FONT="]I have tried to run it but encountered errors. Can anybody advice on how to get it working??
[/FONT]
I have the following query and would like to be able to control the pivot statement through two parameters. Tentatively, I have put 1 and 21 for testing purposes and would like to replace it with variables once I got it working.
[FONT="]TRANSFORM Nz(Count(Case_ID),0) AS CountOfCase_ID[/FONT]
[FONT="]SELECT stag_SGP.OB[/FONT]
[FONT="]FROM stag_SGP[/FONT]
[FONT="]WHERE (((stag_SGP.rWeek) Between 1 And 21) And (([/FONT][FONT="]stag_SGP[/FONT][FONT="].REQUEST_STATUS)="Good") And (([/FONT][FONT="]stag_SGP[/FONT][FONT="].ReqYear)=2009) And [/FONT][FONT="]stag_SGP[/FONT][FONT="].OB IN ('FAIL','PASS'))[/FONT]
[FONT="]GROUP BY [/FONT][FONT="]stag_SGP[/FONT][FONT="].BGrp, [/FONT][FONT="]stag_SGP[/FONT][FONT="].PRIORITY, [/FONT][FONT="]stag_SGP[/FONT][FONT="].OB[/FONT]
[FONT="]PIVOT [/FONT][FONT="]stag_SGP[/FONT][FONT="].rWeek IN ([/FONT][FONT="]stag_SGP[/FONT][FONT="].rWeek >= 1 AND [/FONT][FONT="]stag_SGP[/FONT][FONT="].rWeek <= 21) ;[/FONT]
[FONT="][/FONT]
[FONT="]I have tried to run it but encountered errors. Can anybody advice on how to get it working??
[/FONT]