Am I totally missing something? Why do you believe the two queries should return the same # of rows? First one has a qualification of proj_adv_date < '2008-12-16' whilst the second one does not...
On Mon, Dec 15, 2008 at 12:12 PM, Néstor <rot...@gmail.com> wrote: > I have a char fiel where I am keeping dates formatted as year-month-day > (2006-10-09) > Now I am trying to find all the records between 2 strings (2 dates). The > 2 queries below > should return the same number of records by they do not. > > My query is this: > SELECT COUNT(*) FROM proj where proj_archive=0 AND (proj_adv_date >= > '2008-01-01' AND proj_adv_date < '2008-12-16') order by proj_type, > proj_adv_date, proj_bid_date, proj_name ASC; > +---------+---------------+ > | proj_id | proj_adv_date | > +---------+---------------+ > | 181 | 2008-11-25 | > | 217 | 2008-10-27 | > | 136 | 2008-12-01 | > | 219 | 2008-12-08 | > | 225 | 2008-12-11 | > +---------+---------------+ > 5 rows in set (0.00 sec) > > I get only 5 records returned but if I do this query: > SELECT COUNT(*) FROM proj where proj_archive=0 AND (proj_adv_date > > '2008-01-01') order by proj_type, proj_adv_date, proj_bid_date, proj_name > ASC; > +---------+---------------+ > | proj_id | proj_adv_date | > +---------+---------------+ > | 181 | 2008-11-25 | > | 221 | 2008-12-23 | > | 108 | 2009-01-00 | > | 173 | 2009-03-00 | > | 149 | 2009-10-00 | > | 143 | 2009-7-00 | > | 179 | 2010-04-00 | > | 217 | 2008-10-27 | > | 136 | 2008-12-01 | > | 219 | 2008-12-08 | > | 225 | 2008-12-11 | > | 187 | 2009-01-00 | > | 199 | 2009-01-01 | > | 177 | 2009-02-01 | > | 69 | 2009-03-00 | > | 70 | 2009-03-00 | > | 71 | 2009-03-00 | > | 142 | 2009-03-00 | > | 122 | 2009-04-00 | > | 124 | 2009-04-00 | > | 207 | 2009-04-01 | > | 72 | 2009-07-00 | > | 73 | 2009-07-00 | > | 82 | 2009-07-00 | > | 209 | 2009-10-01 | > | 211 | 2009-10-01 | > | 213 | 2010-03-01 | > +---------+---------------+ > 27 rows in set (0.00 sec) > > thanks, > > Rotsen :-) > -- Distributed Computing stats http://stats.free-dc.org