Get the latest rows (by date property) from a view?
Jeremy Cowgar <[email protected]> Mon, 13 Sep 2010 20:10:46 -0400
| Newsgroups | gmane.comp.db.metakit |
|---|---|
| Message-ID | <[email protected]> |
I have a view that contains ~20,000 rows. Each row has a startedAt
property, when the action began. I would like to get the 20 most recent
actions. Using the Tcl interface I tried all sorts of things, for example:
foreach row [mk::select logdb.log -rsort startedAt -count 20] {
puts $row
}
That simply returns 19 18 17 16 15 14 ... 0 ... Those are the oldest
ones (not in order). I also tried:
mk::select logdb.log -rsort startedAt -start [expr {[mk::view size
logdb.log] - 20}]
but that didn't work either as the entries are not placed in the db in
sequence according to date. That returned the last 20 rows in what
seemed to be in random order.
I typically program with SQL and what I want to accomplish is this:
SELECT * FROM log ORDER BY startedAt DESC LIMIT 20
How can I accomplish this using the Tcl interface to MetaKit?
Thanks,
Jeremy Cowgar
--
You received this message because you are subscribed to the "metakit" group.
To post to this group, send email to [email protected]
To unsubscribe from this group, send email to [email protected]
For more options, visit this group at http://groups.google.com/group/metakit?hl=en