sqlsqlitesqlitestudio

Update + Set + Where updates row but no results


OK, so I am trying to update what is in my table and I want the results without having to do two separate queries. I'm using SQLiteStudio. If I try to do two queries at the same time when I press F9 (Update + Set + Where; and Select + From;), it'll say the query finished, but no rows are loaded and nothing is updated. If I try to do the Update + Set + Where first, it'll update the row but no results. Then I have the do the Select + From query and when I press F9, this time, it shows the updated result. I don't understand why I have to do it in two queries.

The table looks like this:

|ID|FirstName|MiddleName|LastName|
|1 |         |          |        |

The code looks like this:

UPDATE Test1
SET FirstName = 'Jacob'
WHERE ID = 1;

SELECT * FROM Test1;

So my question is how do I go about updating the results and displaying the results in one query? Note: I only have one table.


Solution

  • SQLiteStudio - by default - executes only current query (currently under the cursor). Please try selecting both queries (with mouse, or with Ctrl+a) and then hit Execute. You can change this default behavior in options.