I want to duplicate a record in my database.
First I select the record:
SELECT “Check”, “Check_Amount”, “Deposit_Amount” FROM “MyMoney”
WHERE “ID” = :Enter_ID_No
This brings up a dialog box where I can enter the primary key (ID) of the record I want to copy.
However, when I create a SQL statement to create a new record from the selected record, LibreOffice balks. It won’t accept the WHERE clause.
INSERT INTO “MyMoney” (“Check”, “Check_Amount”, “Deposit_Amount”)
SELECT “Check”, “Check_Amount”, “Deposit_Amount” FROM “MyMoney”
WHERE “ID” = :Enter_ID_No
If I manually enter the ID number, this works great, just as expected.
INSERT INTO “MyMoney” (“Check”, “Check_Amount”, “Deposit_Amount”)
SELECT “Check”, “Check_Amount”, “Deposit_Amount” FROM “MyMoney”
WHERE “ID” = 9
How can I get around this problem so that I could, for example, select a record from a list, note the ID number, and run the SQL and enter the ID number as a user parameter?