このクエリで結果が得られない理由を理解するのに助けが必要です。
上司はすでにデータを取得しているので、そこにあることがわかります。しかし、何らかの理由で私は何も得ていません:
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 Management Studioで、次のようなクエリを実行してID番号を取得しました。
select * from Surveys (nolock) where ABCSurveyName = '718184 Multicultural Shop '