Click here to Skip to main content
14,540,861 members
Rate this:
Please Sign up or sign in to vote.
See more:
I have written below query but it is taking time ,please any one can rewrite the query to get result fast.


I want to remove the post
Posted
Updated 12-Oct-15 22:41pm
v2
Comments
Maciej Los 1-Dec-14 9:01am
   
Reduce the count of subqueries!
Rate this:
Please Sign up or sign in to vote.

Solution 1

There is few ways to improve performance of sql query. See:
http://www.infoworld.com/article/2628420/database/7-performance-tips-for-faster-sql-queries.html[^]
http://www.developer.com/db/10-ways-to-improve-sql-query-performance.html[^]

At the first look, reducing the numbers of subqueries in WHERE statement might help.
   
Rate this:
Please Sign up or sign in to vote.

Solution 2

Your query full of sub-queries, even nested.
Remove those sub-queries and replace them with LEFT JOIN (or INNER JOIN where fits better), that will help you...
   
Comments
Member 10256268 1-Dec-14 23:22pm
   
Can you give me query by removing sub query and apply left join or inner join for above query.
Kornfeld Eliyahu Peter 2-Dec-14 2:09am
   
Not really. I do not know your schema, do not know your request, so it is hard to me to directly help you.
You should use Google to find samples (and there are a lot) and implement them for your case...

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