Whenever I make a post, it doesn't show up until someone replies to it. Odd. Anyway ..
All columns referenced are indexed. salesreport is the 7.5 mil recod table. The query should only return a few hundred rows at the most. I will try the one you provided and play with the order a bit. Thanks. On 3/30/06, Robert Munn <[EMAIL PROTECTED]> wrote: > > Check your indexes on your columns to make sure you are not doing a table > scan somewhere. > > After that, you might try re-writing your query a little. I'll give this a > shot, just an experiment: > > SELECT c.Cat, v.MC, v.CatID, v.VideoID, v.MovieTitle, SUM(s.TotalTime) > FROM catagories c > JOIN videos v on c.catid = v.catid > JOIN salesreport s on v.videoid = s.videoid > JOIN users u on u.UserID = s.UserID > WHERE u.ADVID > 0 > GROUP BY v.VideoID > ORDER BY c.Cat > > I don't know whether this will make any difference at all, but it can't > hurt > to run it. You could also try joining in a different order (start with > users > since that is your select criteria table). > > Are you going to return a large result set from this query? Like several > hundred thousand rows? Could be a long query no matter what you do. ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~| Message: http://www.houseoffusion.com/lists.cfm/link=i:5:202316 Archives: http://www.houseoffusion.com/cf_lists/threads.cfm/5 Subscription: http://www.houseoffusion.com/lists.cfm/link=s:5 Unsubscribe: http://www.houseoffusion.com/cf_lists/unsubscribe.cfm?user=89.70.5 Donations & Support: http://www.houseoffusion.com/tiny.cfm/54