Hi all,
I have a message table defined as such:
db.define_table('message',
Field('recipient', 'integer', writable=False, required=True),
Field('entity', 'string', length=256, required=True, notnull=True),
Field('text', 'string', length=2048, required=True, notnull=True),
Field('created', 'datetime', default=request.now, writable=False,
notnull=True),
format='%(msg_type)s by %(sender)s: %(text)s on %(created)s'
)
I would like to pull a list of most recent messages for a particular
recipient for all entities.
However, on each poll, there might have been multiple messages for any
particular entity since the last poll.
Eg.
recipient entity
text created
8 answer-42-feedback Where are the flies going shoo?
2010-10-30
19:08:02
8 answer-42-feedback This is feedback
2010-10-31 18:32:00
8 answer-42-feedback what the hell?
2010-11-05 21:59:56
8 answer-43-feedback this is a test
2010-10-29 18:57:15
8 answer-45-feedback Green?
2010-10-31 02:24:03
For the above result set, notice that the entity answer-42-feedback
has 3 records, each with a differing timestamp. I'd like to only get
the one with the timestamp 2010-11-05 21:59:56. The records for
answer-43-feedback and answer-45-feedback are fine.
What would be the best way to retrieve the messages required?
Cheers
Ruiwen