[Solved] SQL How to update current row

Creating tables and queries

[Solved] SQL How to update current row

Postby gkick » Tue Nov 26, 2019 9:03 pm

Hello,

Have a timestamp for record created, one for record changed, a field created by default user name and need another one for record changed by.
The normal sql syntax UPDATE "tblxxx" SET "yyyy" = "zzz" needs a WHERE clause so that only the selected record is updated. There does not seem to be a record number property and according to the HSQL man the rownum() can not be used for = or > condition.

Anyone done something similar ?


Thks
Last edited by gkick on Tue Nov 26, 2019 10:03 pm, edited 1 time in total.
Libre Office 6.2 on Windows 10 HSQL 2.5 backend
gkick
 
Posts: 250
Joined: Wed Aug 07, 2019 5:24 pm
Location: Chile

Re: SQL How to update current row

Postby Villeroy » Tue Nov 26, 2019 9:16 pm

Your table should have a primary key to identify a distinct record.
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.4
User avatar
Villeroy
Volunteer
 
Posts: 28431
Joined: Mon Oct 08, 2007 1:35 am
Location: Germany

Re: SQL How to update current row

Postby gkick » Tue Nov 26, 2019 10:02 pm

Ahh, thanks that's it, store the pk to a variable and use it in the where clause, thanks !!!
Libre Office 6.2 on Windows 10 HSQL 2.5 backend
gkick
 
Posts: 250
Joined: Wed Aug 07, 2019 5:24 pm
Location: Chile


Return to Tables & Queries

Who is online

Users browsing this forum: No registered users and 1 guest