[Dbix-class] Searching - two criteria for the same field

Charlie Garrison garrison at zeta.org.au
Tue Feb 10 08:08:08 GMT 2009


Good evening,

On 9/02/09 at 11:06 PM -0800, Gerg Coates <greg at coatesoft.com> wrote:

>my $t = $schema->resultset('Table')->search(
> {
>   'glr_date' => { '>=', $beg_date },
>   'glr_date' => { '<', $end_date }
> }
>);

Syntax from memory, so check the documentation to be sure:

my $t = $schema->resultset('Table')->search(
  { 
    'glr_date' => { 
      '>=', $beg_date, 
      '<',  $end_date 
    }
  }
);

Or maybe you need to do this:

my $t = $schema->resultset('Table')->search(
  { 
    'glr_date' => [  
     -and =>
       { '>=' => $beg_date }, 
       { '<'  => $end_date }
    ] 
  }
);

Charlie

-- 
   Charlie Garrison  <garrison at zeta.org.au>
   PO Box 141, Windsor, NSW 2756, Australia

O< ascii ribbon campaign - stop html mail - www.asciiribbon.org
http://www.ietf.org/rfc/rfc1855.txt



More information about the DBIx-Class mailing list