Crosstab Pivot from parameters (1 Viewer)

acesQuer

Registered User.
Local time
Yesterday, 23:08
Joined
Jun 3, 2010
Messages
13
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=&quot]TRANSFORM Nz(Count(Case_ID),0) AS CountOfCase_ID[/FONT]
[FONT=&quot]SELECT stag_SGP.OB[/FONT]
[FONT=&quot]FROM stag_SGP[/FONT]
[FONT=&quot]WHERE (((stag_SGP.rWeek) Between 1 And 21) And (([/FONT][FONT=&quot]stag_SGP[/FONT][FONT=&quot].REQUEST_STATUS)="Good") And (([/FONT][FONT=&quot]stag_SGP[/FONT][FONT=&quot].ReqYear)=2009) And [/FONT][FONT=&quot]stag_SGP[/FONT][FONT=&quot].OB IN ('FAIL','PASS'))[/FONT]
[FONT=&quot]GROUP BY [/FONT][FONT=&quot]stag_SGP[/FONT][FONT=&quot].BGrp, [/FONT][FONT=&quot]stag_SGP[/FONT][FONT=&quot].PRIORITY, [/FONT][FONT=&quot]stag_SGP[/FONT][FONT=&quot].OB[/FONT]
[FONT=&quot]PIVOT [/FONT][FONT=&quot]stag_SGP[/FONT][FONT=&quot].rWeek IN ([/FONT][FONT=&quot]stag_SGP[/FONT][FONT=&quot].rWeek >= 1 AND [/FONT][FONT=&quot]stag_SGP[/FONT][FONT=&quot].rWeek <= 21) ;[/FONT]

[FONT=&quot][/FONT]
[FONT=&quot]I have tried to run it but encountered errors. Can anybody advice on how to get it working??
[/FONT]
 

Users who are viewing this thread

Top Bottom