Finding the most recent related record?

2005-08-17 Thread Brian Dunning
I have a table of questions, and a table of answers. Each question has a related answer record for each person who has answered that question, and each answer is timestamped. How do I find a list of questions where the MOST RECENT answer is less than 30 days ago? (Basically trying to

Re: Finding the most recent related record?

2005-08-17 Thread Jon Drukman
Brian Dunning wrote: I have a table of questions, and a table of answers. Each question has a related answer record for each person who has answered that question, and each answer is timestamped. How do I find a list of questions where the MOST RECENT answer is less than 30 days ago?

Re: Finding the most recent related record?

2005-08-17 Thread Gleb Paharenko
Hello. If condition 'where the MOST RECENT answer is less than 30 days ago' isn't the same as 'where some answer is less than 30 days ago' in your case? I think they're equal. So the query is: SELECT DISTINCT q.question FROM questions q INNER JOIN answers a ON a.qid=q.id WHERE dateago

Re: Finding the most recent related record?

2005-08-17 Thread Brian Dunning
So simple - I was trying to WAY overcomplicate it. Thanks. :) On Aug 17, 2005, at 10:05 AM, Jon Drukman wrote: Brian Dunning wrote: I have a table of questions, and a table of answers. Each question has a related answer record for each person who has answered that question, and each