I have the follow tables in a database that I am using to store the results of surveys:
http://img19.imageshack.us/img19/5016/strtranans.jpg
Each time I speak to someone at a store (read Shop) I create a new transaction, with a date time (tblTransaction.Created). Each transaction can many question answers associated with it.
My problem is that 2 transactions could both contain different answers to the same question and I am trying to create an SQL query/procedure to return only the latest question answers for a given store.
Here's an example:
I speak to someone at Some Shop Plc. and create a transaction on the 01/01/09 (transaction ID 1). In this transaction I ask QuestionIDs 1 and 2. Then on the 10/01/09 I speak to them again, creating a new transaction (transaction ID 2) and answer questions 2 and 3.
I want to be able to show the list of latest answers; Question 1 from the first transaction and questions 2 and 3 from the second transaction.
Any suggestions would be greatly appreciated.