Yes, I found that out the hard way (bad data import). I'll drop the existing PK and create a composite key. I'll also see if that speeds things up any more. Thanks muchly for the help too.
-----Original Message----- From: Jochem van Dieten [mailto:[EMAIL PROTECTED] Sent: Wednesday, 1 June 2005 11:13 To: CF-Talk Subject: Re: (SOT) Joins aren't always better than subqueries (longish post) James Holmes wrote: > Ah, the PK on wrkenrolments is actually a separate column > (enrolmentid) so there isn't an index to use. Maybe I should define a > composite key for that purpose instead? Yes, you very, very much should so. And not for the purpose of speed, but for the purpose of data integrity. Your query with subselects will throw an exception if there are multiple rows with the same periodid and unitid in the WRKENROLLMENTS table. ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~| 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:208214 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

