Login ProductsSalesSupportDownloadsAbout |
Home » Technical Support » ElevateDB Technical Support » Support Forums » ElevateDB SQL » View Thread |
Messages 1 to 5 of 5 total |
Selecting on dates |
Mon, Apr 23 2012 9:27 AM | Permanent Link |
Peter Hodgson | Hi
new to elevateDB from DBISAM this does not work in EDB Select * from Planner where CAST(StartTime as Date)='2010-12-31' but this does Select * from Planner where CAST(StartTime as Date)=cAST('2010-12-31' AS DATE) Is this right? Is 'yyyy-mm-dd' right? Thanks in advance Peter |
Mon, Apr 23 2012 9:30 AM | Permanent Link |
John Hay | Peter
> Select * from Planner where CAST(StartTime as Date)=cAST('2010-12-31' AS DATE) > Alternatively Select * from Planner where CAST(StartTime as Date)= Date '2010-12-31' John |
Mon, Apr 23 2012 10:30 AM | Permanent Link |
Roy Lambert NLH Associates Team Elevate | Peter
As John says - you may also find it useful to read up on INTERVALs if you do any date arithmetic. You can no longer do things like (date1 - date2) > 90 in SQL Roy Lambert [Team Elevate] |
Mon, Apr 23 2012 10:48 AM | Permanent Link |
Adam Brett Orixa Systems | Peter
CAST('2010-12-31' AS DATE) Still works. You would use it: WHERE StartDate > CAST('2012-12-31' as DATE) You can also use: DATE '2012-12-31' as another poster mentions. WHERE StartDate > DATE '2012-12-31' -- As Roy mentions where you would have written WHERE StartDate > Current_Date - 90 You now have to write: WHERE StartDate > Current_Date - INTERVAL '90' DAY Or you might want to get more or less the same result with: WHERE StartDate > Current_Date - INTERVAL '3' MONTH -- I found INTERVALs a pain when starting EDB, and the date handling makes SQL more verbose than with DBISAM. However they do have benefits ... as you can now specify intervals such as working weeks, and whole months much more accurately. With my SQL Scripts from DBISAM I did a lot of Find and Replace to cope with the changes of querying dates ... and that worked pretty well. |
Mon, Apr 23 2012 1:51 PM | Permanent Link |
Peter Hodgson | Thanks Guys
I'm on a steep learning curve with this!!!!! Peter |
This web page was last updated on Sunday, May 5, 2024 at 10:18 AM | Privacy PolicySite Map © 2024 Elevate Software, Inc. All Rights Reserved Questions or comments ? E-mail us at info@elevatesoft.com |