Forum: Ruby Sequel: Get latest record of multiple

Announcement (2017-05-07): www.ruby-forum.com is now read-only since I unfortunately do not have the time to support and maintain the forum any more. Please see rubyonrails.org/community and ruby-lang.org/en/community for other Rails- und Ruby-related community platforms.
Ee469623eb1b8e6e35d192822b9c4aa2?d=identicon&s=25 Florian Aßmann (Guest)
on 2007-06-04 07:15
(Received via mailing list)
Hi there,

first of all I'd like to say that Sequel seems very promising, thank
you Sharon. I'm currently writing a threaded daemon and I can't
figure out how to build this SQL String.

I have an array of category ids which I use to select import records:
db[:imports].filter :category_id => categories.map(:id)

Since a category has multiple imports I only want the latest Import
before a Date X for each category. Is this even possible?

Sincerely
Florian
93697354fea1f7bae30d3ab89917c4c3?d=identicon&s=25 Alin Popa (alin_popa)
on 2007-06-04 08:26
Florian Aßmann wrote:
> Hi there,
>
> first of all I'd like to say that Sequel seems very promising, thank
> you Sharon. I'm currently writing a threaded daemon and I can't
> figure out how to build this SQL String.
>
> I have an array of category ids which I use to select import records:
> db[:imports].filter :category_id => categories.map(:id)
>
> Since a category has multiple imports I only want the latest Import
> before a Date X for each category. Is this even possible?
>
> Sincerely
> Florian

Hi Florian,

I think that you need a field in that table in which you have to put the
timestamp. Maybe this feature that you want is present in some advanced
RDBMS like Oracle/DB2 or maybe Postgresql.

Best regards,

Alin
Ee469623eb1b8e6e35d192822b9c4aa2?d=identicon&s=25 Florian Aßmann (Guest)
on 2007-06-05 00:06
(Received via mailing list)
Hi Alin,

Am 04.06.2007 um 08:26 schrieb Alin Popa:

> Hi Florian,
>
> I think that you need a field in that table in which you have to
> put the
> timestamp. Maybe this feature that you want is present in some
> advanced
> RDBMS like Oracle/DB2 or maybe Postgresql.

I defined some methods in my Model that - hopefully - build me up the
query, still needs to be tested though. As the moment I'm having
sequence problems when I try to create Records... :(

Sincerely
Florian

P.S. I'm using PostgreSQL 8.1
This topic is locked and can not be replied to.