On Tue, January 30, 2007 2:30 pm, Ken Dozier wrote: > Thanks to all for your input, guys. > > Regarding the construction of the SQL query, I would love to try it > with > SUBSELECTs; but, alas, we are using RHEL 3 which ships with MySQL > 3.23. I > don't think RH supports any 4.0 or later versions of MySQL on RHEL 3, > so I'm > stuck with 3.23 for the time being. I had tried a query like this: > > SELECT d.account FROM data AS d, accesslist AS a WHERE > d.account=a.account > AND a.username='username' > > but it also took quite a bit of time. Since the problem would appear > for > only a few users, I may have to simply hard code a workaround for the > time > being and then come back to it later. You should DEFINITELY look into the EXPLAIN statement to find out what MySQL isn't using any indices on that query... You *do* have indices on your tables, right?... It should not be a slow query at all, I don't think. In the short term, getting the a.account WHERE a.username='username' should be a VERY fast query, and then you don't really care what d.account is, because it is equal to a.account in your JOIN. So you're probably over-simplified whatever you are trying to do to the point where we can't help you... But the SQL question should be on an SQL list anyway, so that's just as well. -- Some people have a "gift" link here. Know what I want? I want you to buy a CD from some starving artist. http://cdbaby.com/browse/from/lynch Yeah, I get a buck. So? -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php