View Single Post

   
  #2 (permalink)  
Old 02-28-2008, 09:30 AM
Michael Austin
 
Posts: n/a
Default Re: Concerned about dates [ extract vs <>= ]

sveint wrote:

> Hello,
>
> I am concerned as similiar queries, only changing the way I specify the
> dates, give different results.
>
> Query A would use EXTRACT, example:
> EXTRACT(month FROM accountingdate)=' . $currentmonth . '
>
> Query B would use <>=, example:
> accountingdate>=' . $begindate . '
>
> Now the odd thing is that I get different results, for a sum of sales
> figures. A quick check of the actual sales summed up outside of the
> database reveals that Query B gives the correct answer.


To SQL, 1-nov-xxxx (all years) would be included in QueryA result, you must also
include the year.

> Now this is a major concern as I just Query A type syntax in some other
> reports. Why doesn't it work correctly? Any links to more information
> about extract? The manual information suggests that Query A should be
> synonymous with Query B.


No, they are not synonymous. See previous...

>
> Thanks for any information
>




--
Michael Austin
Reply With Quote