Home     |     .Net Programming    |     cSharp Home    |     Sql Server Home    |     Javascript / Client Side Development     |     Ajax Programming

Ruby on Rails Development     |     Perl Programming     |     C Programming Language     |     C++ Programming     |     IT Jobs

Python Programming Language     |     Laptop Suggestions?    |     TCL Scripting     |     Fortran Programming     |     Scheme Programming Language


 
 
Cervo Technologies
The Right Source to Outsource

MS Dynamics CRM 3.0

Ruby Programming Language

Sequel: Get latest record of multiple


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

Florian Amann 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

--
Posted via http://www.ruby-forum.com/.

Hi Alin,

Am 04.06.2007 um 08:26 schrieb Alin Popa:

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

Add to del.icio.us | Digg this | Stumble it | Powered by Megasolutions Inc