Login ProductsSalesSupportDownloadsAbout |
Home » Technical Support » ElevateDB Technical Support » Support Forums » ElevateDB General » View Thread |
Messages 1 to 3 of 3 total |
Date fields in filters |
Sat, Oct 6 2012 7:00 AM | Permanent Link |
Colin Wood VirtualTec P/L | Could someone please guide me in the right direction... I've created a table filter that needs to display any records which are due to finish, a day prior to the planned finish date. The syntax is incorrect when it reaches "- 1" but I'm not sure how to correct it.
Filter := '((PlannedFinish - 1) <= Current_Timestamp) and (Current_Timestamp < PlannedFinish)'; Any help appreciated. Colin |
Sat, Oct 6 2012 8:36 AM | Permanent Link |
Uli Becker | Colin,
> Could someone please guide me in the right direction... I've created a table filter that needs to display any records which are due to finish, a day prior to the planned finish date. The syntax is incorrect when it reaches "- 1" but I'm not sure how to correct it. > > Filter := '((PlannedFinish - 1) <= Current_Timestamp) and (Current_Timestamp < PlannedFinish)'; You have to use intervals to calculate with dates and timestamps. Using SQL (filter should be the same), try this: select * from MyTable where PlannedFinish >= Current_Timestamp - INTERVAL '1' DAY Please note the quotes around "1". Have a look at the manual (search for "interval types"). You'll find some useful information there, e.g.: << -- This example specifies a YEAR interval literal SELECT * FROM Orders WHERE (OrderDate + INTERVAL '1' YEAR) BETWEEN DATE '2006-01-01' AND DATE '2006-01-31' -- This example specifies a DAY interval literal SELECT * FROM Orders WHERE (ShipDate - OrderDate) > INTERVAL '2' DAY -- This example specifies an HOUR interval literal SELECT * FROM TimeClockEntries WHERE (PunchOutTime - PunchInTime) > INTERVAL '8' HOUR >> Uli |
Sat, Oct 6 2012 8:59 AM | Permanent Link |
Colin Wood VirtualTec P/L | Thanks Uli, that did the trick. I'll have another look through the manual too
Col |
This web page was last updated on Tuesday, May 7, 2024 at 06:25 PM | Privacy PolicySite Map © 2024 Elevate Software, Inc. All Rights Reserved Questions or comments ? E-mail us at info@elevatesoft.com |