Page 1 of 1

Help with WHERE clause syntax in SQL

PostPosted: Fri Apr 19, 2019 7:19 pm
by JWB23
Hi,

I need help with my WHERE clause syntax. I’m looking to return rows that have a certain date that’s older than a month.

Example:

SELECT…
WHERE tbl_date < CURRENT_DATE – 30 DAYS

I’ve tried no less than 8,000 variations of this, but always got an SQL error along with a very unhelpful message. Any ideas?

Thanks

Re: Help with WHERE clause syntax in SQL

PostPosted: Fri Apr 19, 2019 8:11 pm
by FJCC
Try
Code: Select all   Expand viewCollapse view
WHERE DATEDIFF('dd', tbl_date, CURRENT_DATE) > 30

Re: Help with WHERE clause syntax in SQL

PostPosted: Fri Apr 19, 2019 8:32 pm
by Villeroy
If the status bar of your database document window looks like this ...
Image
... then your database is HSQL 1.8 which is documented here: http://www.hsqldb.org/doc/1.8/guide/ch09.html