If this is your first visit, be sure to check out the FAQ by clicking the link above. You may have to register before you can post: click the register link above to proceed. To start viewing messages, select the forum that you want to visit from the selection below. |
|
|
Thread Tools | Display Modes |
#1
|
|||
|
|||
Optimizing my query using MAX
I need some one to help me Optimize my query using MAX or DMax or Top 1,
however. I have a large result query that sumirized the sales (for each region) from past months. Then I need to find the max data from last months for each year. I have used Dmax, I have used a subquery in the select section, I have used a Top 1 in the having section... all of them give me the same result which is the correct one. My problem is the speed. It takes too long to be executed. Is there a way I can work this out more efficiently? Thanks a lot in advanced, Lina |
#2
|
|||
|
|||
Optimizing my query using MAX
Lina wrote:
I need some one to help me Optimize my query using MAX or DMax or Top 1, however. I have a large result query that sumirized the sales (for each region) from past months. Then I need to find the max data from last months for each year. I have used Dmax, I have used a subquery in the select section, I have used a Top 1 in the having section... all of them give me the same result which is the correct one. My problem is the speed. It takes too long to be executed. Is there a way I can work this out more efficiently? Thanks a lot in advanced, Lina Using the MAX() function requires the query engine to create a new temporary table (or file) of the sorted data and then go thru that data searching for the data that matches the MAX criteria. Sometimes you can increase the speed of queries on summary queries by temporarily storing the summarized data in a temp. table, then run the MAX query against the temp. table. YMMV. You could also post your query (queries) and see if someone can come up with a better solution(s). -- MGFoster:::mgf00 Oakland, CA (USA) |
Thread Tools | |
Display Modes | |
|
|