[x]
Posted via EE Mobile

Search, ask, and monitor your questions on the go with EE Mobile. Visit Experts Exchange from your mobile device and never be out of touch again.

Question
[x]
Attachment Details
[x]
The Solution Rating System

With so many solutions, how can you tell which solutions are most likely to help you and which ones are not? To provide you with a tool to use, we rate our solutions based on various elements that most accurately determine if a solution is a quality solution. To explain what factors affect the solution rating, here are the elements we take into consideration when formulating our solution rating.

  • The Grade of the Solution
  • The Zone Rank of the Expert Providing the Solution
  • The Number of Author and Expert Comments
  • The Number of Experts Contributing
  • The Feedback of the Community

Your Input Matters
Because of the way the system is set up, the most important variable in this equation is you. As a member of Experts Exchange, you are able to cast your vote on the quality of the solutions in regard to how complete, accurate, helpful and easy to understand each solution is. When you provide your feedback, each rating is adjusted accordingly. So, if you see a solution that has a poor rating that you think is a good solution, let us know by rating it. As you do, the rating will be adjusted and will become more accurate for other members of our site.

If you have any suggestions that you would like to make for our rating system, please ask a question in the Suggestions Zone of Community Support.

Thank you!

6.2

SQL Query optimization

Asked by JooZ in Databases Miscellaneous

Tags: optimization, select

Hi all,

Could some expert provide a possible optimsation of the following two SQL statements. They are very cluttered but seem to be the only arrangement of nested SELECT clauses that can give me the appropriate results that i want.

SELECT     COUNT(sBug_ID) AS countedRecords
FROM         tblBugs
WHERE     (iID IN
                          (SELECT     MAX(iID) AS Expr1
                            FROM          tblBugs
                            WHERE      (sBug_ID IN
                                                       (SELECT     tblBugs.sBug_ID
                                                         FROM          tblBug_ID INNER JOIN
                                                                                tblBugs ON tblBug_ID.sBug_ID = tblBugs.sBug_ID
                                                         WHERE      (tblBugs.dtDate BETWEEN CONVERT(DATETIME, '2005-6-2', 102) AND CONVERT(DATETIME, '2005-6-2', 102) + 1) AND
                                                                                (tblBugs.bOriginal = 1))) AND (dtDate BETWEEN CONVERT(DATETIME, '2005-6-2', 102) AND CONVERT(DATETIME, '2005-6-2',
                                                   102) + 1)
                            GROUP BY sBug_ID))


and



SELECT     COUNT(sBug_ID) AS subTotalCases
FROM         tblBugs
WHERE     (iID IN
                          (SELECT     MAX(iID) AS Expr1
                            FROM          tblBugs
                            WHERE      (sBug_ID IN
                                                       (SELECT     tblBugs.sBug_ID
                                                         FROM          tblBug_ID INNER JOIN
                                                                                tblBugs ON tblBug_ID.sBug_ID = tblBugs.sBug_ID
                                                         WHERE      tblBug_ID.sProject = '1stProject' AND (tblBugs.dtDate BETWEEN CONVERT(DATETIME, '2005-6-2', 102) AND
                                                                                CONVERT(DATETIME, '2005-6-2', 102) + 1))) AND (dtDate BETWEEN CONVERT(DATETIME, '2005-6-2', 102) AND
                                                   CONVERT(DATETIME, '2005-6-2', 102) + 1)
                            GROUP BY sBug_ID)) AND (sStatus = 'Pending')


----------------------

I get SQL timeouts when running these scripts from the Query window in Enterprise Manager. I know the queries arent very elegant, but the nested SELECTs seem to be the only way i can pull the results that i want.

Any assistance is much appreciated. I'm not connected to the net during weekends, so i'll check this thread again on Monday. In the meantime, have a good weekend, all! :)


[+][-]06/03/05 03:57 AM, ID: 14138318Expert Comment

At Experts Exchange, members can ask their questions to thousands of technology professionals, also known as Experts. Experts compete and collaborate to answer those questions by leaving comments like this one.

Start your 30-day free trial to view this Expert Comment or ask the Experts your question.

 
[+][-]06/03/05 04:07 AM, ID: 14138372Expert Comment

At Experts Exchange, members can ask their questions to thousands of technology professionals, also known as Experts. Experts compete and collaborate to answer those questions by leaving comments like this one.

Start your 30-day free trial to view this Expert Comment or ask the Experts your question.

 
[+][-]06/03/05 04:09 AM, ID: 14138384Expert Comment

At Experts Exchange, members can ask their questions to thousands of technology professionals, also known as Experts. Experts compete and collaborate to answer those questions by leaving comments like this one.

Start your 30-day free trial to view this Expert Comment or ask the Experts your question.

 
[+][-]06/03/05 04:24 AM, ID: 14138454Expert Comment

At Experts Exchange, members can ask their questions to thousands of technology professionals, also known as Experts. Experts compete and collaborate to answer those questions by leaving comments like this one.

Start your 30-day free trial to view this Expert Comment or ask the Experts your question.

 
[+][-]06/03/05 01:14 PM, ID: 14142891Expert Comment

At Experts Exchange, members can ask their questions to thousands of technology professionals, also known as Experts. Experts compete and collaborate to answer those questions by leaving comments like this one.

Start your 30-day free trial to view this Expert Comment or ask the Experts your question.

 
[+][-]06/05/05 08:53 PM, ID: 14150672Expert Comment

At Experts Exchange, members can ask their questions to thousands of technology professionals, also known as Experts. Experts compete and collaborate to answer those questions by leaving comments like this one.

Start your 30-day free trial to view this Expert Comment or ask the Experts your question.

 
[+][-]06/06/05 11:29 PM, ID: 14159438Author Comment

Often, when Experts are collaborating with members who have asked questions, they will request additional information about the problem. Askers respond with an author comment like this one.

Start your 30-day free trial to view this Author Comment or ask the Experts your question.

 
[+][-]06/06/05 11:43 PM, ID: 14159473Author Comment

Often, when Experts are collaborating with members who have asked questions, they will request additional information about the problem. Askers respond with an author comment like this one.

Start your 30-day free trial to view this Author Comment or ask the Experts your question.

 
[+][-]06/07/05 09:13 AM, ID: 14163424Expert Comment

At Experts Exchange, members can ask their questions to thousands of technology professionals, also known as Experts. Experts compete and collaborate to answer those questions by leaving comments like this one.

Start your 30-day free trial to view this Expert Comment or ask the Experts your question.

 
[+][-]06/07/05 09:17 AM, ID: 14163456Expert Comment

At Experts Exchange, members can ask their questions to thousands of technology professionals, also known as Experts. Experts compete and collaborate to answer those questions by leaving comments like this one.

Start your 30-day free trial to view this Expert Comment or ask the Experts your question.

 
[+][-]06/07/05 09:20 AM, ID: 14163479Expert Comment

At Experts Exchange, members can ask their questions to thousands of technology professionals, also known as Experts. Experts compete and collaborate to answer those questions by leaving comments like this one.

Start your 30-day free trial to view this Expert Comment or ask the Experts your question.

 
[+][-]06/07/05 09:27 AM, ID: 14163544Expert Comment

At Experts Exchange, members can ask their questions to thousands of technology professionals, also known as Experts. Experts compete and collaborate to answer those questions by leaving comments like this one.

Start your 30-day free trial to view this Expert Comment or ask the Experts your question.

 
[+][-]06/07/05 09:32 AM, ID: 14163583Expert Comment

At Experts Exchange, members can ask their questions to thousands of technology professionals, also known as Experts. Experts compete and collaborate to answer those questions by leaving comments like this one.

Start your 30-day free trial to view this Expert Comment or ask the Experts your question.

 
[+][-]06/08/05 01:09 AM, ID: 14168639Author Comment

Often, when Experts are collaborating with members who have asked questions, they will request additional information about the problem. Askers respond with an author comment like this one.

Start your 30-day free trial to view this Author Comment or ask the Experts your question.

 
[+][-]06/08/05 01:31 AM, ID: 14168746Author Comment

Often, when Experts are collaborating with members who have asked questions, they will request additional information about the problem. Askers respond with an author comment like this one.

Start your 30-day free trial to view this Author Comment or ask the Experts your question.

 
[+][-]01/05/06 01:50 PM, ID: 15623358Expert Comment

At Experts Exchange, members can ask their questions to thousands of technology professionals, also known as Experts. Experts compete and collaborate to answer those questions by leaving comments like this one.

Start your 30-day free trial to view this Expert Comment or ask the Experts your question.

 
[+][-]01/09/06 06:33 AM, ID: 15649762Accepted Solution

View this solution now by starting your 30-day free trial. Setting up your free trial is quick, easy, and secure. We will return you to this solution, unlocked, when you're done.

About this solution

Zone: Databases Miscellaneous
Tags: optimization, select
Sign Up Now!
Solution Provided By: DarthMod
Participating Experts: 7
Solution Grade: A
 
 
Loading Advertisement...
20091021-EE-VQP-81