Subject | Re: [IBDI] Re: SQL Date Question |
---|---|
Author | Ivan Prenosil |
Post date | 2000-08-23T10:57:38Z |
> I had tried using EXTRACT but guess that I didn't use the correctUsing EXTRACT looks nice, but has disadvantage that it can't use index.
> syntax when I tried it. The way I solved the problem was by using
> BETWEEN as in "WHERE field BETWEEN '8/1/2000' and '8/31/2000'". The
> problem with this is that I then had to create a table with the
> number
> of days in each month so that I can get the correct last day of the
> month. It looks like the EXTRACT route will be simpler to implement.
What about this simple solution (no need to know "month size"):
WHERE (field >= '8/1/2000') AND (field < '9/1/2000')
(unlike BETWEEN, it works on both DATE and TIMESTAMP type of fields)
Ivan
prenosil@...