Using a mySQL Database with thousands of records. For the query below, 
to optimize performance, I'd like to be able to return on the TOP N records.

A. "SELECT TOP 50" doesn't work in mySQL. "Top" is only SQL
     Server, correct?
B. "From Shows Limit 50" returns an error as well.

1. What's the equal of "TOP" in mySQL?
2. At what point in the query is that actually evaluated?
    I don't want the first 50 records, I want the first
    TOP records out of all of them according to the sort.

I don't want to use MAXROWS because certain variations of the query 
takes freaking forever and I need to stop the number being returned at 
the database, not at the application.


*** QUERY (simplified)***

SELECT
    Airdates.ShowID,
    Airdate.Rating,
    Shows.Title,
    Shows.Season,
FROM
   Shows
INNER JOIN Airdates ON (Shows.ShowID = Airdates.ShowID)
WHERE
   1=1 <!-- here because everything below has an "if" statement --->
   and Shows.Genre like 'Drama'
ORDER BY Airdates.Rating DESC

~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~|
Logware (www.logware.us): a new and convenient web-based time tracking 
application. Start tracking and documenting hours spent on a project or with a 
client with Logware today. Try it for free with a 15 day trial account.
http://www.houseoffusion.com/banners/view.cfm?bannerid=67

Message: http://www.houseoffusion.com/lists.cfm/link=i:4:223023
Archives: http://www.houseoffusion.com/cf_lists/threads.cfm/4
Subscription: http://www.houseoffusion.com/lists.cfm/link=s:4
Unsubscribe: http://www.houseoffusion.com/cf_lists/unsubscribe.cfm?user=89.70.4
Donations & Support: http://www.houseoffusion.com/tiny.cfm/54

Reply via email to