-1
我想要做的是從SQLSystem中提取以下信息。 我被困在如何將參數放入我的查詢中。SQL SERVER PARAMETER問題
有沒有人制定過如何做到這一點?
參數[Date From] DateTime,[Date To] DateTime,[Site Group] Text;
SELECT Contacts.Name, Points.M1_Code1, DataProfile.Date, DataProfile.[00:30], DataProfile.[01:00], DataProfile.[01:30], DataProfile.[02:00], DataProfile.[02:30], DataProfile.[03:00], DataProfile.[03:30], DataProfile.[04:00], DataProfile.[04:30], DataProfile.[05:00], DataProfile.[05:30], DataProfile.[06:00], DataProfile.[06:30], DataProfile.[07:00], DataProfile.[07:30], DataProfile.[08:00], DataProfile.[08:30], DataProfile.[09:00], DataProfile.[09:30], DataProfile.[10:00], DataProfile.[10:30], DataProfile.[11:00], DataProfile.[11:30], DataProfile.[12:00], DataProfile.[12:30], DataProfile.[13:00], DataProfile.[13:30], DataProfile.[14:00], DataProfile.[14:30], DataProfile.[15:00], DataProfile.[15:30], DataProfile.[16:00], DataProfile.[16:30], DataProfile.[17:00], DataProfile.[17:30], DataProfile.[18:00], DataProfile.[18:30], DataProfile.[19:00], DataProfile.[19:30], DataProfile.[20:00], DataProfile.[20:30], DataProfile.[21:00], DataProfile.[21:30], DataProfile.[22:00], DataProfile.[22:30], DataProfile.[23:00], DataProfile.[23:30], DataProfile.[24:00]
FROM (Lookup INNER JOIN Groups ON Lookup.Lookup_Id = Groups.Lookup_Id) INNER JOIN (Contacts INNER JOIN (Points INNER JOIN DataProfile ON Points.Id = DataProfile.Point_Id) ON Contacts.Id = Points.Contacts_Id) ON Groups.Link_Id = Contacts.Id
WHERE (((Lookup.Lookup_Name)=[Site Group]) AND ((DataProfile.Date) Between [Date From] And [Date To]) AND ((Points.Type)='Electricity') AND ((DataProfile.Type)=0))
ORDER BY Contacts.Name, Points.M1_Code1, DataProfile.Date;