Ok, so say I have two tables.
Question
- questionID
- QuestionDescription
Answer
- AnswerID
- QuestionID
- AnswerDescription
- CreatedDate
And say I want to create a query which returns the question and latest created answer like these columns
QuestionID QuestionName AnswerDescription CreatedDate
Is that possible?
I can do a query that gets all the combinations of quesitons and answers
SELECT q.QuestionID, q.QuestionName, a.AnswerDescription, a.CreatedDate FROM QUESTION q
INNER JOIN ANSWER a
ON q.questionID = a.QuestionID
but is there a way I can do something like this but have it only return the latest answer instead of all of them?
To get per question, SQL Server 2005+