hsingh1981
Programmer
Hi all am trying to create a cross tab query. What am trying to show is list of staff and the equipment names next to them as columns. If they have the equipment then and display it as 'X'.
Can anyone take look at what i've done so far and give me little pointers to achieving my goal?
Can anyone take look at what i've done so far and give me little pointers to achieving my goal?
Code:
SELECT dbo.R_EquipmentArea.EquipID, dbo.R_Equipment.Equipment, dbo.Staff.Firstname, dbo.Staff.Surname
FROM dbo.EquipTraining INNER JOIN
dbo.Staff ON dbo.EquipTraining.StaffID = dbo.Staff.StaffID INNER JOIN
dbo.R_Equipment ON dbo.EquipTraining.EquipID = dbo.R_Equipment.ID INNER JOIN
dbo.R_EquipmentArea ON
dbo.R_Equipment.ID = dbo.R_EquipmentArea.EquipID EXEC sys_CrossTab ' dbo.EquipTraining INNER JOIN
dbo.Staff ON dbo.EquipTraining.StaffID = dbo.Staff.StaffID INNER JOIN
dbo.R_Equipment ON dbo.EquipTraining.EquipID = dbo.R_Equipment.ID INNER JOIN
dbo.R_EquipmentArea ON dbo.R_Equipment.ID = dbo.R_EquipmentArea.EquipID',
'R_EquipmentArea.EquipID', 'R_Equipment.Equipment', 'R_Equipment.Equipment', 'Staff.Firstname, Staff.Surname'