Help with WHERE clause syntax in SQL

Creating tables and queries

Help with WHERE clause syntax in SQL

Postby JWB23 » Fri Apr 19, 2019 7:19 pm

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
OpenOffice 4 on Windows 10
JWB23
 
Posts: 9
Joined: Wed Jun 20, 2018 12:02 am

Re: Help with WHERE clause syntax in SQL

Postby FJCC » Fri Apr 19, 2019 8:11 pm

Try
Code: Select all   Expand viewCollapse view
WHERE DATEDIFF('dd', tbl_date, CURRENT_DATE) > 30
Windows 10 and Linux Mint, since 2017
If your question is answered, please go to your first post, select the Edit button, and add [Solved] to the beginning of the title.
FJCC
Moderator
 
Posts: 7204
Joined: Sat Nov 08, 2008 8:08 pm
Location: Colorado, USA

Re: Help with WHERE clause syntax in SQL

Postby Villeroy » Fri Apr 19, 2019 8:32 pm

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
Please, edit this topic's initial post and add "[Solved]" to the subject line if your problem has been solved.
Ubuntu 18.04, no OpenOffice, LibreOffice 6.x
User avatar
Villeroy
Volunteer
 
Posts: 26875
Joined: Mon Oct 08, 2007 1:35 am
Location: Germany


Return to Tables & Queries

Who is online

Users browsing this forum: No registered users and 4 guests