General information
Category:
Coding, syntax & commands
After looking at your code you can optimize it in a way you may not have anticipated:
Rather than use "HAVING" to filter the query, use an "AND" expression like this:
Select ... blah blah blah ...
Where ... blah blah ...
And myField = SomeValue
Rather than
Select ... blah blah blah ...
Where ... blah blah ...
Having myField = SomeValue
Doing this instead of using the "HAVING" expression will save your query this way:
The HAVING part of the query is applied to the final result set of the query. It does not limit the data being queried. It's particularly usefull for finding data in aggregation queries. Like: give me the salesmen who's total sales is greater than 1 million dollars. To find this you must sum up the sales of all the salesmen then you can find the result.
But if you put the query in the AND expression, it limits the number of records included in the result set, so the query has fewer records to process, which speeds things up. You'll get even more improvement if you can make the AND expressions RUSHMORE optimizable.
HTH
Previous
Reply
View the map of this thread
View the map of this thread starting from this message only
View all messages of this thread
View all messages of this thread starting from this message only