Subject | WHERE mydate STARTING WITH 'ccyy-mm' |
---|---|
Author | skoczian |
Post date | 2008-05-08T16:15:04Z |
mydate is a DATE field, 'ccyy-mm' is the year and month part of a date
in ISO string representation. I'm surprised that this WHERE clause
works, and of course it's much shorter than
WHERE EXTRACT(YEAR FROM mydate) = thisyear AND EXTRACT(MONTH FROM
mydate) = thismonth
with integers thisyear and thismonth. At first glance it seems to give
the same results.
Is this legal SQL or what did I overlook? Speed is no issue here, the
database is very small and will grow very slowly.
Using Firebird 2.1 on Windows XP (but I suppose the OS isn't relevant
here).
Thanks for comments on this!
in ISO string representation. I'm surprised that this WHERE clause
works, and of course it's much shorter than
WHERE EXTRACT(YEAR FROM mydate) = thisyear AND EXTRACT(MONTH FROM
mydate) = thismonth
with integers thisyear and thismonth. At first glance it seems to give
the same results.
Is this legal SQL or what did I overlook? Speed is no issue here, the
database is very small and will grow very slowly.
Using Firebird 2.1 on Windows XP (but I suppose the OS isn't relevant
here).
Thanks for comments on this!