http://www.mysql.com/doc/A/N/ANSI_diff_Sub-selects.html says that for some sub-queries you can create temporary tables, but I couldn't find any examples in the tutorial that show the use of a temporary table. Are there any?
Or, if you're feeling generous, could you just tell me how to do this :) -- clickable_ad_link is a table with time_sent field of type datetime, and a "userid" field that is a foreign key referencing the "ID" field of the table "user". I want to select all users for which there is no clickable_ad_link whose time_sent is less than a week ago. If sub-selects were allowed, the query would be: select * from user where ID not in (select user.ID from user, clickable_ad_link where user.ID = clickable_ad_link.userid AND clickable_ad_link.time_sent > DATE_SUB(NOW(), interval 1 week)); Using temporary tables, what I'd like to do is create a temporary table MYTEMP of all the clickable_ad_link rows with time_sent more recent than one week, and then do select * from user left join MYTEMP on user.ID = MYTEMP.userid where MYTEMP.userid IS NULL; but I can't find syntax for creating temporary tables anywhere. -Bennett [EMAIL PROTECTED] http://www.peacefire.org (425) 649 9024 --------------------------------------------------------------------- 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