problem solved! Thanks Mark for the message offlist. I used something like:
select threads.* from threads left join replies on threads.id = replies.tid and (threads.stamp > {$weekago} and replies.stamp > {$weekago}) order by threads.id DESC Thanks, Justin on 19/11/02 9:22 PM, Justin French ([EMAIL PROTECTED]) wrote: > Hi all, > > Not sure if I should be using distinct, or some sort of complex WHERE query, > so here goes: > > I have two related tables: > > threads > id,udi,message,stamp > > replies > id,thread_id,uid,message,stamp > > (the stamps are unix timestamps) > > > What I'd like to do select * from the table threads, selecting all threads > which > > a) have a unix timestamp within the past week (easy) > b) have a reply in the replies table within the past week (confused) > > The aim being to show a list of all threads that have been active (posted, > and/or replied to) within a certain timeframe. > > > Getting the tiemstamp for "last week" is easy in PHP, more trying to figure > out the logic of the query... > > > Many thanks, > > Justin French > -------------------- > http://Indent.com.au > Web Developent & > Graphic Design > -------------------- > > > --------------------------------------------------------------------- > 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 > > Justin French -------------------- http://Indent.com.au Web Developent & Graphic Design -------------------- --------------------------------------------------------------------- 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