On Tue, 17 Oct 2006, [EMAIL PROTECTED] wrote:

> Hi All,
> 've got a table, called estimate,containing 4 fields : id, ref, revision,
> status.
> id is the primary key,
> ref is the number of the estimate in format (number/year)
> revision is a int that specifies the revision of the estimate.
> Now... in table can be more than one rows with same ref but several
> revision numbers
> I've done something like resultset({ %search },{ group_by => [qw /ref /]}
> but in some cases this give me back the row with the lowest id for that
> group.
> Example:
> 1,1/2006,0,0  <--- this is the row returned by the query
> 2,1/2006,1,0
> 3,1/2006,3,0
> 4,1/2006,4,0
>
> but... i need the one with id = 4
> Any help on doing it?
> Thanks in advance
> Tiziano
>

Use select => and instead of just the plain columns, have: { max => 
'revision'} for that field.. which will get you the maximal revision 
number per ref.

Jess


_______________________________________________
List: http://lists.rawmode.org/cgi-bin/mailman/listinfo/dbix-class
Wiki: http://dbix-class.shadowcatsystems.co.uk/
IRC: irc.perl.org#dbix-class
SVN: http://dev.catalyst.perl.org/repos/bast/trunk/DBIx-Class/
Searchable Archive: http://www.mail-archive.com/[email protected]/

Reply via email to