Hi Andreas, > I'm just getting started with mysql so please bear with me. =8-} > I do a 3 table query like: > SELECT a.x, b.y, c.z > FROM a, b, c > WHERE a.b_fk = b.id AND a.c_fk = c.id; > That works so far. > In c can be rows which aren't active anymore. > There is a good_from and a good_until DATETIME field which should be > respected in the query above. Can I filter the old rows out before I do > the SELECT ? > I'd like to reduce the workload.
The WHERE clause is used to filter in/out data rows. What about adding AND NOW() BETWEEN c.good_from AND c.good_until or similar? (manual has good examples of BETWEEN, and another good keyword is JOIN (as well as WHERE)) With regards to workload/optimisation, yes it is appropriate to sequence the WHERE clause so that the most exclusive condition comes first. Free advice: Make it work before you make it better! Regards, =dn --------------------------------------------------------------------- Before posting, please check: http://www.mysql.com/manual.php (the manual) http://lists.mysql.com/ (the list archive) To request this thread, e-mail <[EMAIL PROTECTED]> To unsubscribe, e-mail <[EMAIL PROTECTED]> Trouble unsubscribing? Try: http://lists.mysql.com/php/unsubscribe.php