[dancer-users] howto query between date ?

David Precious davidp at preshweb.co.uk
Wed Feb 12 16:58:30 GMT 2014


On Wed, 12 Feb 2014 17:19:08 +0100
Tonton <to.tonton at gmail.com> wrote:

> hello
> 
> i write this in my sub
> 
> my $count_DossiersClos = database('asav')->quick_count(
>             'DossierClos',
>             {DateCloture =>{ 'lt' => "2013-12-01
> 00:00:01"},DateCloture => { 'gt' => "2013-11-01 00:00:01"}});
>                 return $count_DossiersClos;
> 
> but the query just use the last  Date cloture and in mysql.log i read

Yeah - it's a hashref and you're using the same key name twice, that
will never work.

I believe you can say:

{ 
    DateCloture => {
        gt => '2013-11-01 00:00:01',
        lt => '2013-12-01 00:00:01',
    },
}


Cheers

Dave P


-- 
David Precious ("bigpresh") <davidp at preshweb.co.uk>
http://www.preshweb.co.uk/     www.preshweb.co.uk/twitter
www.preshweb.co.uk/linkedin    www.preshweb.co.uk/facebook
www.preshweb.co.uk/cpan        www.preshweb.co.uk/github




More information about the dancer-users mailing list