Please start any new threads on our new site at https://forums.sqlteam.com. We've got lots of great SQL Server experts to answer whatever question you can come up with.

 All Forums
 Other Forums
 MS Access
 pivot function

Author  Topic 

AskSQLTeam
Ask SQLTeam Question

0 Posts

Posted - 2005-06-01 : 08:37:43
satish writes "Hi,

This is my Access Query.I want to convert this into Sql query.

TRANSFORM Count(tblTESTPumpMaster.SerialNum) AS CountOfSerialNum
SELECT IIf([Pass]="1","Tested",IIf([Pass]="3","Inspected","Failed")) AS Result, Count(tblTESTPumpMaster.SerialNum) AS Total
FROM (tblTESTFigureNumberGroups INNER JOIN tblTESTPumpMaster ON tblTESTFigureNumberGroups.FigNum = tblTESTPumpMaster.FigureNum) INNER JOIN tblTESTTestEvents ON tblTESTPumpMaster.SerialNum = tblTESTTestEvents.SerialNum
WHERE (((tblTESTTestEvents.TestDate)>Now()-Time()) AND ((tblTESTTestEvents.Pass) Is Not Null))
GROUP BY IIf([Pass]="1","Tested",IIf([Pass]="3","Inspected","Failed"))
PIVOT tblTESTFigureNumberGroups.[Pump Sub Group] In ("Small 3600","Large 3600","Small A","Large A","Small F","Large F","Stainless Steel","Type C","Lube Oil","Cooler","PC","Flow Divider","Fuel Pump","Other Fuel Systems","Other");"

AjarnMark
SQL Slashing Gunting Master

3246 Posts

Posted - 2005-06-01 : 14:11:20
You want to convert it to SQL Server syntax? Read Rob's article on Dynamic Crosstabs

---------------------------
EmeraldCityDomains.com
Go to Top of Page
   

- Advertisement -