February 15, 2013 at 12:39 am
[font="Courier New"]Hi All,
This is the query i have written
Declare @FromDate DATETIME
Declare @EndDate DATETIME
Declare @mar nvarchar(4)
Set @FromDate = '2011-06-30 00:00:00.000'
--Set @EndDate = '2011-07-28 00:00:00.000'
Set @mar = '1001'
Select max(so.VKBUR) As MAR,
max(so.BEZEI) As NAME,
max(sd.KUNRG) As P,
max(cm.NAME1) As NAME2,
max(sd.PRODH) As SEGMENT,
max(sl.VTEXT) As MAT_DESCRIPTION,
max(za.FGCODE) As IT,
max(za.FGDESC) As IT_DESCRIPTION,
max(za.EANNUM) As U,
max(sd.FKIMG) As QUANTITY,
max(sd.VALINR) As VALUE_IN_FC,
max(sd.NTGEW) As WEIGHT_
From
sa_off so WITH(NOLOCK)
INNER JOIN
SA_DA sd WITH(NOLOCK)
On
so.VKBUR = sd.VKBUR
INNER JOIN
Cust_Mas cm WITH(NOLOCK)
On
sd.KUNRG = cm.KUNNR
INNER JOIN
Segment_line04 sl WITH(NOLOCK)
On
sd.pro_level_4 = sl.PRO_LEVEL_4
INNER JOIN
ZBARARCHIVE za WITH(NOLOCK)
On
sd.KUNRG = za.INTP
Where
so.VKBUR = @market
AND
sd.KUNRG = za.INTP
AND
sd.PROD = sl.PROD_LEVEL_4
AND
sd.FKDAT = @FromDate
Group BY
sd.KUNRG,
cm.NAME1,
sl.VTEXT,
sd.PROD
Is there any way to optimise above query as it took too much time to display result set i.e for 100 line items time taken by the query: 1 minute and 46 Sec. PFA Excel sheet for required ouput and output coming from above query.
Thanks & Regards,
Bhushan[/font]
February 15, 2013 at 1:03 am
Can you post the Actual Execution plan as well as the DDL for the Tables, and indexes.
These will enable people to offer practical solutions.
_________________________________________________________________________
SSC Guide to Posting and Best Practices
Viewing 2 posts - 1 through 1 (of 1 total)
You must be logged in to reply to this topic. Login to reply