[Solved] DELETE function in SQL command syntax

Discuss the database features
Post Reply
JimNH14
Posts: 8
Joined: Thu Jan 03, 2013 4:20 pm

[Solved] DELETE function in SQL command syntax

Post by JimNH14 »

[Solved] I am trying to weed my database to remove data according to criteria.
I am trying to use the command panel accessed from the front panel Tools/SQL. When I used DELETE FROM with a criterion <H0001 then it worked.
I could not make it work when the criterion was < a date even when I enclosed the date in #s
Last edited by JimNH14 on Tue May 29, 2018 11:29 am, edited 1 time in total.
JimNH
OpenOffice 4.01 on
Windows 10
User avatar
Sliderule
Volunteer
Posts: 1278
Joined: Thu Nov 29, 2007 9:46 am

Re: DELETE function in SQL command syntax

Post by Sliderule »

Below is an example of a DELETE statement.

Please note:
  1. You will have to change "MY_TABLE" to the name of your table
  2. You will have to change "MY_DATE_COLUMN" to the name of the column in your table
  3. You will have to change the sample date to a date in YYYY-MM-DD format, surrounded by single quotes. Additional note, it is important that the YEAR is a four digit year. So, change '2014-07-15' to the particular date you desire. '2014-07-15' is Year: 2014, Month: the 7th month of the year, and Day: the 15th day of the month. :D
  4. In the statement below, it is using a < ( less than ) operation, you could modify it to use:
    1. <= ( less than or equal to )
    2. = ( equal to )
    3. > ( greater than )
    4. >=( greater than or equal to )

Code: Select all

DELETE FROM "MY_TABLE" WHERE "MY_DATE_COLUMN" < '2014-07-15'
I hope this helps, please be sure to let me / us know.

Sliderule

Thanks to add [Solved] in your 1st post Subject (edit button top right) if this issue has been resolved.
JimNH14
Posts: 8
Joined: Thu Jan 03, 2013 4:20 pm

Re: DELETE function in SQL command syntax

Post by JimNH14 »

Thank you for your quick response.
It has worked. I had forgotten the syntax - thanks again
JimNH
JimNH
OpenOffice 4.01 on
Windows 10
Post Reply