I have a Amazon SimpleDB domain with attributes "MachineName" and "TimeStamp" which logs user activity. I want to create a query that returns the latest log entry for each machine. Is this something I can do with a SimpleDB query? I'm not that proficient at regular SQL queries but I think I'd want to do something with TOP, Distinct, and/or a sub query. But non of these are supported by SimpleDB.
Asked
Active
Viewed 667 times
1 Answers
0
Can you please try this query -
select * from <domain_name>
where TimeStamp
is not null AND MachineName
= 'A' order by TimeStamp
desc limit 1

Ashish Pancholi
- 4,569
- 13
- 50
- 88
-
No I want a list of the last log entries from each machine, not just the last log entry of the entire list. – Eric Anastas Aug 31 '12 at 22:28
-
Please try the above query and let me know. – Ashish Pancholi Sep 03 '12 at 05:07
-
This will return the last log entry for Machine "A", but I want the last log entry from all machines. The problem is there doesn't seem to be a way to get a list of machine names with no duplicates. – Eric Anastas Sep 04 '12 at 06:09
-
@EricAnastas Please have a look on this thread. It has all possible solution. https://forums.aws.amazon.com/thread.jspa?messageID=78471𓊇 – Ashish Pancholi Sep 04 '12 at 10:44