[dancer-users] howto query between date ?

Tonton to.tonton at gmail.com
Wed Feb 12 16:19:08 GMT 2014


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

140212 17:05:21    18 Connect   admin at localhost on asav
                   18 Query     set autocommit=1
                   18 Query     SELECT COUNT(*) FROM `DossierClos` WHERE
`DateCloture` > '2013-11-01 00:00:01'

ingenuous i hope :
SELECT COUNT(*) FROM `DossierClos` WHERE `DateCloture` > '2013-11-01
00:00:01' and `DateCloture` < '2013-12-01 00:00:01'

does it better to write the query ?

regards
T.
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.preshweb.co.uk/pipermail/dancer-users/attachments/20140212/147592d2/attachment.html>


More information about the dancer-users mailing list