我需要帮助弄清楚为什么我没有得到这个查询的任何结果。
我的老板已经提取了数据,所以我知道它在那里。但由于某种原因,我没有得到任何东西:
SELECT SessionSID as 'ResponseID'
, TargetID
, TargetName
, SurveyNumber
, ABCSurveyName
, SurveyID as 'RedirectedSurveyID'
, SupplierID
, SupplierName
, RespondentID
, PID
, IPAddress
, IsLive
, EntryDate
, LastDate
, LK_ResponseStatusID as 'Response Status Code'
, ClientLK_ResponseStatusID as 'Client Response Status Code'
, LK_SupplierLinkTypeName
, ProjectID
, ParentSID
, TargetCPI
, SupplierCPI
, DefaultCPI
FROM BI_Sessions (nolock)
WHERE EntryDate BETWEEN '06-07-2012' AND '06-08-2012'
AND ABCSurveyName like 'EBAY4263-718184%'
AND SupplierID = 42
更新数据在这里(我知道我很抱歉,它很长):
ResponseID TargetID TargetName SurveyNumber ABCSurveyName RedirectedSurveyID SupplierID SupplierName RespondentID PID IPAddress IsLive EntryDate LastDate Response Status Code Client Response Status Code LK_SupplierLinkTypeName ProjectID ParentSID TargetCPI SupplierCPI DefaultCPI
6dd94974-9e1b-44ce-8a3e-e1680f921a2e -1 NULL 13958 Tracking NO_Kund_Cint4005 12963 42 EBAY 31962330 08a945eb-d780-4baa-892a-d4132e59afb5 80.213.119.232 1 2012-06-07 00:01:51.420 2012-06-07 00:02:05.327 3 1 Targeted / Reuse Supplier-Account Only 4637 c847ad2f-9a9f-4a81-8da3-a74d49f8143e 3 10 10
c2d53463-f81b-4156-87a7-e70203a4fc0e -1 NULL 12200 Tracking NO_Kund_Cint4002 11205 42 EBAY 2513971 0e9d0e01-9009-40a8-a42e-65e1e6d4b1f8 85.167.23.63 1 2012-06-07 00:03:38.220 2012-06-07 00:03:55.143 3 38 Targeted / Reuse Supplier-Account Only 3857 4f74bbaf-0bb3-4430-9529-72c5dff36d3a 3 10 10
编辑:你如何使用索引来加速查询?
更新:更多:
SessionID int no 4 10 0 no (n/a) (n/a) NULL
SessionSID nvarchar no 128 yes (n/a) (n/a) SQL_Latin1_General_CP1_CI_AS
AccountID int no 4 10 0 yes (n/a) (n/a) NULL
RespondentID int no 4 10 0 yes (n/a) (n/a) NULL
SurveyID int no 4 10 0 yes (n/a) (n/a) NULL
SurveyNumber int no 4 10 0 yes (n/a) (n/a) NULL
ABCSurveyName nvarchar no 256 yes (n/a) (n/a) SQL_Latin1_General_CP1_CI_AS
SupplierID int no 4 10 0 yes (n/a) (n/a) NULL
SupplierName nvarchar no 128 yes (n/a) (n/a) SQL_Latin1_General_CP1_CI_AS
TargetID int no 4 10 0 yes (n/a) (n/a) NULL
TargetCPI float no 8 53 NULL yes (n/a) (n/a) NULL
ClientCPI float no 8 53 NULL yes (n/a) (n/a) NULL
QuotaCPI float no 8 53 NULL yes (n/a) (n/a) NULL
SupplierCPI float no 8 53 NULL yes (n/a) (n/a) NULL
DefaultCPI float no 8 53 NULL yes (n/a) (n/a) NULL
EntryDate datetime no 8 yes (n/a) (n/a) NULL
LastDate datetime no 8 yes (n/a) (n/a) NULL
LK_RespondentPathID int no 4 10 0 yes (n/a) (n/a) NULL
LK_ResponseStatusID int no 4 10 0 yes (n/a) (n/a) NULL
IsLive bit no 1 yes (n/a) (n/a) NULL
PID nvarchar no 256 yes (n/a) (n/a) SQL_Latin1_General_CP1_CI_AS
IPAddress nvarchar no 32 yes (n/a) (n/a) SQL_Latin1_General_CP1_CI_AS
ClientLK_ResponseStatusID int no 4 10 0 yes (n/a) (n/a) NULL
ParentSID nvarchar no 128 yes (n/a) (n/a) SQL_Latin1_General_CP1_CI_AS
SurveyQualificationID int no 4 10 0 yes (n/a) (n/a) NULL
TargetName nvarchar no 128 yes (n/a) (n/a) SQL_Latin1_General_CP1_CI_AS
SupplierLinkID int no 4 10 0 yes (n/a) (n/a) NULL
LK_SupplierLinkTypeID int no 4 10 0 yes (n/a) (n/a) NULL
LK_SupplierLinkTypeName nvarchar no 128 yes (n/a) (n/a) SQL_Latin1_General_CP1_CI_AS
EntryType int no 4 10 0 yes (n/a) (n/a) NULL
ExitType int no 4 10 0 yes (n/a) (n/a) NULL
ProjectID int no 4 10 0 yes (n/a) (n/a) NULL
ProjectName nvarchar no 128 yes (n/a) (n/a) SQL_Latin1_General_CP1_CI_AS
CreateUserID int no 4 10 0 yes (n/a) (n/a) NULL
CreateDate datetime no 8 yes (n/a) (n/a) NULL
UpdateUserID int no 4 10 0 yes (n/a) (n/a) NULL
UpdateDate datetime no 8 yes (n/a) (n/a) NULL
LK_RecordStatusID bit no 1 yes (n/a) (n/a) NULL
LK_CountryLanguageID int no 4 10 0 yes (n/a) (n/a) NULL
LK_CountryLanguageName nvarchar no 128 yes (n/a) (n/a) SQL_Latin1_General_CP1_CI_AS
SurveyAccountName nvarchar no 128 yes (n/a) (n/a) SQL_Latin1_General_CP1_CI_AS
SurveyAccountID int no 4 10 0 yes (n/a) (n/a) NULL
编辑:我需要老板的帮助,现在一切都解决了。还有另一个有用的表可以从中提取 ID,因此使用索引很有帮助。
在 MSSQL Server 管理工作室中,我只是运行了一个这样的查询来获取该 ID #:
select * from Surveys (nolock) where ABCSurveyName = '718184 Multicultural Shop '