bauhsoj
08-09-2006, 03:25 PM
How can I structure a query so that I only get back a result if the keyword I am searching for is in the top 1,000 of the results?
I am currently using the following query and then running through the array using PHP to check if the keyword is in the top 1,000. However, I would like to eliminate the PHP step to save processing time and CPU usage.
SELECT keyword FROM lookup_table ORDER BY lookup_count DESC LIMIT 0, 1000
After getting back the result above I would use a loop to get all 1,000 keywords. If I could just check whether the query succeeded or failed based on the keyword that would be much better.
I am currently using the following query and then running through the array using PHP to check if the keyword is in the top 1,000. However, I would like to eliminate the PHP step to save processing time and CPU usage.
SELECT keyword FROM lookup_table ORDER BY lookup_count DESC LIMIT 0, 1000
After getting back the result above I would use a loop to get all 1,000 keywords. If I could just check whether the query succeeded or failed based on the keyword that would be much better.