Click here to Skip to main content
14,447,523 members
Rate this:
Please Sign up or sign in to vote.
See more:
my query is taking long time to execute due to this facing error timed out on browser

here is my query

What I have tried:

SELECT DISTINCT
View_DistributorRetailerDetailLedger.CompanyName AS SellerName, ISNULL(SumOfContributionAmountBuyerWiseNF.NetworkFamilyAmount, 0)
+ ISNULL(SumOfContAmntManuallyWinnerBuyerWiseNetwork.ScehemAmount, 0) AS NetworkFamilyAmount,
ISNULL(SumOfContributionAmountBuyerWiseShopkeeper.ShopkeeperAmount, 0) + ISNULL(SumOfContAmntManuallyWinnerByerWiseShopkeeper.ScehemAmount, 0)
AS ShopkeeperAmount, Config_SchemeName_1.Name as SchemeName
FROM SumOfContributionAmountBuyerWiseShopkeeper INNER JOIN
SchemeSetup ON SchemeSetup.AmountTarget * 1000000 <= SumOfContributionAmountBuyerWiseShopkeeper.BusinessAmount INNER JOIN
Config_LedgerDuration ON SumOfContributionAmountBuyerWiseShopkeeper.LedgerDurationID = Config_LedgerDuration.LedgerDurationID AND
SchemeSetup.StartDate = Config_LedgerDuration.StartDate AND SchemeSetup.EndDate = Config_LedgerDuration.EndDate INNER JOIN
Config_SchemeName AS Config_SchemeName_1 ON SchemeSetup.SchemeNameID = Config_SchemeName_1.ID RIGHT OUTER JOIN
Invoices ON SumOfContributionAmountBuyerWiseShopkeeper.SellerID = Invoices.SellerID AND
SumOfContributionAmountBuyerWiseShopkeeper.SellerTypeID = Invoices.SellerTypeID RIGHT OUTER JOIN
View_DistributorRetailerDetailLedger LEFT OUTER JOIN
SumOfContAmntManuallyWinnerBuyerWiseNetwork RIGHT OUTER JOIN
Invoices AS Invoices_1 LEFT OUTER JOIN
Config_LedgerDuration AS Config_LedgerDuration_1 INNER JOIN
SchemeSetup AS SchemeSetup_1 INNER JOIN
SumOfContributionAmountBuyerWiseNF ON SchemeSetup_1.AmountTarget * 1000000 <= SumOfContributionAmountBuyerWiseNF.BusinessAmount ON
Config_LedgerDuration_1.StartDate = SchemeSetup_1.StartDate AND Config_LedgerDuration_1.EndDate = SchemeSetup_1.EndDate ON
Invoices_1.SellerID = SumOfContributionAmountBuyerWiseNF.SellerID AND Invoices_1.SellerTypeID = SumOfContributionAmountBuyerWiseNF.SellerTypeID ON
SumOfContAmntManuallyWinnerBuyerWiseNetwork.SellerID = SumOfContributionAmountBuyerWiseNF.SellerID AND
SumOfContAmntManuallyWinnerBuyerWiseNetwork.SellerTypeID = SumOfContributionAmountBuyerWiseNF.SellerTypeID ON
View_DistributorRetailerDetailLedger.ID = SumOfContributionAmountBuyerWiseNF.SellerID AND
View_DistributorRetailerDetailLedger.TypeID = SumOfContributionAmountBuyerWiseNF.SellerTypeID ON
SumOfContributionAmountBuyerWiseShopkeeper.SellerID = View_DistributorRetailerDetailLedger.ID AND
SumOfContributionAmountBuyerWiseShopkeeper.SellerTypeID = View_DistributorRetailerDetailLedger.TypeID LEFT OUTER JOIN
SumOfContAmntManuallyWinnerByerWiseShopkeeper ON
SumOfContributionAmountBuyerWiseShopkeeper.SellerID = SumOfContAmntManuallyWinnerByerWiseShopkeeper.SellerID AND
SumOfContributionAmountBuyerWiseShopkeeper.SellerTypeID = SumOfContAmntManuallyWinnerByerWiseShopkeeper.SellerTypeID
WHERE (SchemeSetup.SchemeNameID =@SchemeID) AND (View_DistributorRetailerDetailLedger.ID <> 138)
Posted
Updated 16-May-16 23:14pm

1 solution

Rate this:
Please Sign up or sign in to vote.

Solution 1

And? What do you expect us to do about it? :laugh:

Start with SQL and profile the query: How To: Use SQL Profiler[^]
This will give you a heap of information to look though and work out where your query is slow - you can then work on either reorganising your data or reworking the query to improve the speed.

We can't do that: we don't have any access to your data, so we couldn't even run the query if we wanted to!
   
Comments
Noman Suleman 17-May-16 5:51am
   
yes i understand just need some reference link for that which were you provided
OriginalGriff 17-May-16 6:03am
   
Follow the link...
Noman Suleman 17-May-16 6:32am
   
ok

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)




CodeProject, 503-250 Ferrand Drive Toronto Ontario, M3C 3G8 Canada +1 416-849-8900 x 100