0

I am trying to run the UPDATE command in SQL to change the values of certain columns based on a specified ID.

UPDATE Table
SET variable1=300,variable2=600
WHERE ID=platinum;

However, whenever I try to run the query (I am using Libreoffice Base), I get the following error message:

The given command is not a SELECT statement. Only queries are allowed.

I am encountering this problem whenever I try to run a query which does not have a SELECT command. Can anyone provide any input?

percy
  • 33
  • 5
  • It will be related to how/where you execute that SQL. How/where do you execute that SQL? – Alex K. Apr 29 '16 at 15:00
  • 1
    What tool/version of SQL are you using? It sounds like it only wants you reading and not writing. – Tim Biegeleisen Apr 29 '16 at 15:00
  • 1
    I have no experience in Libreoffice Base, but hopefully this helps you out: https://ask.libreoffice.org/en/question/32700/how-to-create-an-update-query-in-base-sql/ – J Petersen Apr 29 '16 at 15:01
  • I am using Libreoffice Base where both the table is contained, and to execute the query. – percy Apr 29 '16 at 15:01
  • While we're on the topic, what's the best (or standard) environment that professionals use to run SQL queries? – percy Apr 29 '16 at 15:02
  • 1
    If `platinum` is a literal value, then you must wrap it in single quotes. This might not resolve the issue, but it still is necessary. – trincot Apr 29 '16 at 15:09
  • *"what's the best environment"*: Questions asking us to recommend or find a book, tool, software library, tutorial or other off-site resource are [off-topic for Stack Overflow](http://stackoverflow.com/help/on-topic). – trincot Apr 29 '16 at 15:12
  • What is `platinum` -- a literal value, a variable, or a column from another table? – Jim K Apr 29 '16 at 16:57
  • 2
    "platinum" is a set of characters - data type CHAR – percy Apr 30 '16 at 09:36

1 Answers1

1

In LO Base, there are two main ways to run an UPDATE command: Tools -> SQL or create a macro.

For examples and details, see How to create an update query with Open Office Base?

Community
  • 1
  • 1
Jim K
  • 12,824
  • 2
  • 22
  • 51