[Solved] SQL Delete Records from range

Discuss the database features
Locked
MPEcho
Posts: 101
Joined: Wed Sep 07, 2016 11:30 pm

[Solved] SQL Delete Records from range

Post by MPEcho »

Greetings All,

I have a functioning database. Its a split database with HSQLDB,

I was attempting to copy the "people" table using the Base GUI to create empty table "people2". Accidentally copied the entire table back to itself. I've identified the duplicate records, within a range of field 'pid'.

Can anyone advise a SQL command to delete records in a range?

I tried ( using Tools | SQL in Base )
DELETE FROM 'people'
where 'pid' between 641 and 1213

the return I get is: "unexpected token: people : line: 2 at ./connectivity/source/drivers/jdbc/Object.cxx:173

Feels like I'm missing something obvious. Thanks in advance
Last edited by MPEcho on Sat Mar 22, 2025 2:14 am, edited 1 time in total.
Libre Office 24.2.7.2 Ubuntu 24.04
FJCC
Moderator
Posts: 9541
Joined: Sat Nov 08, 2008 8:08 pm
Location: Colorado, USA

Re: SQL Delete Records from range

Post by FJCC »

The names of tables and columns should be in double quotes

Code: Select all

DELETE FROM "people"
where "pid" between 641 and 1213
OpenOffice 4.1 on Windows 10 and Linux Mint
If your question is answered, please go to your first post, select the Edit button, and add [Solved] to the beginning of the title.
MPEcho
Posts: 101
Joined: Wed Sep 07, 2016 11:30 pm

Re: SQL Delete Records from range

Post by MPEcho »

FJCC wrote: Sat Mar 22, 2025 12:34 am The names of tables and columns should be in double quotes

Code: Select all

DELETE FROM "people"
where "pid" between 641 and 1213
Where is the "DOH!" imoji?! I knew I was missing something.
Libre Office 24.2.7.2 Ubuntu 24.04
Locked