Questions tagged [sql-update]

An SQL UPDATE statement is used to change existing rows in a table.

Filter by
Sorted by
Tagged with
0 votes
0 answers
19 views

How to display SUM value from three EditNumberField() in a Text() in Jetpack Compose

Need to display sum value in Total Text() from three user input values in BlueJay, Chickadee, Redpoll EditNumberField()s. I have tried to do this through a Query and through the code. QUERY table name:...
littleoldlady's user avatar
0 votes
0 answers
37 views

PDOStatement::rowCount() returning number of rows then 0 in one call

I work with a MySQL DB and want to check if my UPDATE request works correctly. To do so, after I executed my request, I want to return "true" to be able to redirect the user if the request ...
Manon-PM's user avatar
-1 votes
0 answers
27 views

mysql query to update from many to one

I have two tables like this Table shopcats contains shopname and shop category program_name category BrandsGalaxy Καλλυντικά BrandsGalaxy Ανδρική Μόδα BrandsGalaxy Παιδική βρεφική μόδα ...
Gacha SS's user avatar
1 vote
1 answer
48 views

ExecuteUpdateAsync with query on the new value

I'm trying to migrate some old code that is still using foreach to update N values. I have been reading a lot about ExecuteUpdateAsync but i can't seem to understand if my use case is actually ...
João Cardoso's user avatar
0 votes
2 answers
60 views

Select + update query in the same table

I am using MariaDB and I am trying to create a query that updates the boolean column is_popular of my photos table, called Pics. To find out which photos are "popular", I pick the top 10 ...
Ommadawn's user avatar
  • 2,542
1 vote
1 answer
49 views

How to update join table using sqlite?

I've read many similar threads but still can't make it work. I have 2 tables, "stores_bars" and "house_data" and I need to update part of their join to make this work that way: ...
Peter.k's user avatar
  • 1,487
1 vote
2 answers
35 views

How to rank rows based on two columns using SQLite

I have a table like this. I want to rank each row based on the date column so that the end result is the same rank if the two values of record_number and date are equal and different rank if the ...
Nemra Khalil's user avatar
1 vote
1 answer
41 views

PHP sql query not working to replace update all rows

Trying to update table rows for a specific state_id the insert works but with an error, it doesnt use the right city_name .... So this is what we tried and remember we are still learning PHP so any ...
Skipper's user avatar
  • 41
0 votes
2 answers
49 views

Re-Insert/Update primary key value after a mistake (restoration) [duplicate]

I encounter a problem in SQL Server. We have a table Country with N_Country as its primary key. Please note the table have like 10 columns but I am only showing these two for the example: N_Country ...
Maxime's user avatar
  • 15
0 votes
1 answer
44 views

Create table with effective_from_date and effective_to_date from history table in BigQuery

I have a table in which data gets appended for the changes. No delete or update, only append is done by a cloud run job. Base table Supplier_ID Supplier_Name Supplier_Contact Last_Modified 123 ABC ...
Ashok KS's user avatar
  • 669
-1 votes
1 answer
73 views

Trigger is not firing in SQL Server

I've created the following trigger that should be looking for an update. My understanding is that an update creates an entry in the DELETED table and the INSERTED table. So I am unsure as to why the ...
Jason Orman's user avatar
0 votes
1 answer
32 views

Clear button not clearing textbox field php

I'm creating a simple site since I'm still studying. We have an activity which includes user signup, viewing of records of the signed up users, editing/updating records. In updating, once the user ...
fam's user avatar
  • 1
0 votes
0 answers
65 views

Access SQL UPDATE with a correlated sub query on a single table

I have a table with a grid reference string, a year number and a total number (HectadGridRef, YYYY and TotalRecordsAllSpecies). I have added a column, FiveYearTotalRecords. I want to update the new ...
Steve Hewitt's user avatar
-1 votes
0 answers
35 views

error in sql-request "UPDATE" with "JOIN" in one request (sqlite3, python) [duplicate]

I have a problem with sql request: Traceback (most recent call last):cursor.execute(f"UPDATE selected_universities JOIN users SET selected_universities.{change_params[1]} = '{new_data}' WHERE (...
DOOOOOOOM's user avatar
0 votes
0 answers
40 views

ERROR: could not serialize access due to concurrent update (SQLSTATE 40001)

this is the code I have, it is a simple update : UPDATE foregin_schema.foreign_table a SET wa_round = b.u_round, update_date = b.lst_update, round_batch_id = null ...
Vaso Miruashvili's user avatar
0 votes
0 answers
18 views

Msg 8117, Level 16, State 1, Line 17 Operand data type varchar is invalid for multiply operator

This is my SQL code: DECLARE @TempTableList TABLE (ID INT IDENTITY(1,1),NAME NVARCHAR(300)) BEGIN INSERT INTO @TempTableList (NAME) ( SELECT NAME FROM SYS.tables WHERE NAME LIKE 'BASKRSAPMT_MTG_20%') ...
Vinbeatz180's user avatar
0 votes
1 answer
24 views

UPDATE column with the first not empty occurrence from another table that matching id

I would like to update names in a very large table with the first not empty name value from another table, but the other table stores multiple language names and couldn't figure out a working query ...
Laci K's user avatar
  • 585
-1 votes
1 answer
40 views

How to use Lead in Update SQL command

This works with SELECT: (LEAD(AltCode,2) OVER (ORDER BY AltCode) ) from [clroot].[Material] but not with Update USE [MEKON-EPE] UPDATE [clroot].Material SET String1 = (LEAD(AltCode, 2) OVER (ORDER ...
D.j. Black's user avatar
0 votes
1 answer
26 views

Room Database Update a column (CHeckbox)

I recently started programming apps and don't have that much experience yet. Especially not with database programming. I have a shoppinglist and want to check items. I still can't manage to update the ...
Jonas's user avatar
  • 1
0 votes
2 answers
67 views

Update multiple columns based on values of another table in stored procedure

I am trying to write a dynamic merge procedure that is able to update multiple columns based on values of another table. I try to store query result as a string which I can then use to build my ...
Maeaex1's user avatar
  • 725
0 votes
1 answer
41 views

SQL update set case when else

I'm trying to update a value based on some condition. The code I wish to edit to use this condition looks like this (and works without the condition): UPDATE [SomeSchema].[Synchronization] SET [...
Zenith's user avatar
  • 146
1 vote
0 answers
38 views

SQL Server trigger on a view to start a procedure

I have a view and I'd like to implement a trigger or procedure to sum up all values in one column, store it with a timestamp and a ID inside of a new table so i get a aggregation over time. Each time ...
Carlo's user avatar
  • 11
0 votes
2 answers
55 views

How to search all rows in a column for a value using STRING_SPLIT in an UPDATE Query

I have one table with a single number in each row and I need to determine if that number is in any row in another table that contains ; separated numbers. I am currently using loops to go through the ...
Dizzy49's user avatar
  • 1,412
0 votes
1 answer
35 views

Update column with concat subquery result SQL

I have written the following code to concat myData into one row, based on the StagingNotificationId. I now want to replace the original newData with the result of my sub query but struggling to do ...
John 's user avatar
0 votes
1 answer
51 views

Update imported foreign table and update statement updates incorectly

I have two table: table_1 and table_2. create table table_1 ( user_id integer, dt date, s_wager numeric, lst_update timestamp, must_be_insert integer, ...
Vaso Miruashvili's user avatar
0 votes
1 answer
52 views

Postgresql Error "Column does not exists" in UPDATE ... FROM statement

I am trying to update the column of one table with values from another table using UPDATE ... SET in postgresql. CREATE TABLE cars ( id integer PRIMARY KEY, name varchar(40), model_id ...
BeanSalad's user avatar
0 votes
0 answers
26 views

Copy value from a row to another row in the same table in MySql

Here my table "Stocks" This is product quantities from 3 différents shops. As you can see, all the products have a quantity value provided for "shop 1" but not for "shop 3&...
Tidjy's user avatar
  • 27
0 votes
1 answer
78 views

Update a Table using a Python Dictionary keys and values for where Clause

I wish to update a SQL Server table. Its a big table (with multiple items to be updated at one shot) and I have an issue in updating that by putting where statements manually. So I created a Python ...
Stan's user avatar
  • 876
0 votes
1 answer
37 views

SQL Update Select Statement Subquery

I am stuck on an SQL Update Statement and was hoping for guidance on where I am going wrong. This query below yields the following results. SELECT a.ident, a.iata_code, m.nameAirport, m....
user22743392's user avatar
0 votes
0 answers
53 views

Maximum number of batched UPDATE statements in one query

Knowing that one can batch together multiple UPDATE queries into a single query by appending a semi-colon to them, is there a maximum number of UPDATE statements allowed in one query? Does it depend ...
sean.net's user avatar
  • 735
0 votes
0 answers
12 views

how to write a update statement SQL Oracle developer to get data from tables and input it into their own columns

This is my problem "There can be errors preventing data to be properly inserted into the database. This will require you to go into tables individually to add, delete, or modify data. You see ...
codierosie's user avatar
1 vote
2 answers
82 views

How to make a subquery get latest updates during UPDATE statement

I have two tables, organization and address. organization table has an address_id column but all the rows have address_id set to NULL. I want to SET address_id in organization table equal to a random ...
dev-rifaii's user avatar
0 votes
1 answer
28 views

SQL- Average all transactions that match id

I am using SQLite and attempting to find the average transaction price of a good by ID. I am attempting to update the A.avg_price with the average price of all transactions in the quarter for that ...
tspecht's user avatar
0 votes
0 answers
19 views

MySQL Update function not updating table [duplicate]

I'm trying to update a table data by running the following: UPDATE Products SET SellPrice = 60 WHERE 'ProductId' = 'P6'; The table is not updating even though it is running successfully. This is the ...
user20489871's user avatar
-1 votes
2 answers
39 views

PostgreSQL - update a column value using a subquery

Table countries contains information about different countries and another column: ALTER TABLE countries ADD COLUMN three_rivers BOOL DEFAULT FALSE I want to update the value for the countries that ...
ddoch003's user avatar
0 votes
1 answer
32 views

python sqlite query that only updates values if the variables used are not NULL

My sqlite query is updating columns with the empty variables that are being passed in instead of ignoring the empty variables and keeping the current value in the column. My program askes the user to ...
RoundoDuck's user avatar
1 vote
2 answers
92 views

Updating nvarchar(max) in SQL Server with huge value

I'm trying to manually update a SQL Server column of type nvarchar(max) with a huge JSON parsed as text. It's a simple, straightforward query: UPDATE Books SET Story = '' WHERE Id = 23 The problem ...
Filip5991's user avatar
  • 395
1 vote
1 answer
30 views

MySQL: Set value in column based on other tables data (need optimize)

I have two tables in a MySQL v8 database. Table relations child_id parent_id 11 1 12 1 13 1 21 2 23 2 Table dates id date 1 2023-01-01 11 2023-05-15 12 NULL 13 0000-00-00 2 2023-07-01 21 ...
Adam Kutrasiński's user avatar
1 vote
2 answers
72 views

BigQuery Update a Repeated column in a Table using another table

I am trying to write an update or merge BigQuery SQL to update the data_profile.name of table1 (repeated column) using another reference table having dataprofile data of table2 (flattendata). Using ...
DataVishesh's user avatar
1 vote
1 answer
63 views

Creating an Update Report using Joins in SQL

I have Sales data in Microsoft Access 2016 that I am trying to update on a weekly basis to show Customer ID, Most Recent Purchase, Order Qty, and Return Qty. As the weeks go by these values can change ...
Thomas Coverson II's user avatar
1 vote
2 answers
67 views

Postgres 11 update query on conflict

Suppose I have an update query for a table with constraints (Postgres 11). I do not know the constraints so I won't be able to determine whether an update query will fail or not. If an update query ...
Mark Smith's user avatar
0 votes
0 answers
42 views

Apache ignite performing slow in update query and getting fetch too large error

Apache ignite is performing very slow with dataset 300k records and 19 columns when using update query. error 1: I am using single node apache ignite with all default memory configuration. I used ...
Devassy Pauly's user avatar
2 votes
3 answers
85 views

Improve SQL Server Query to be "thread safe"

I have an application that process incoming messages, but based on what type the message is I want to process them in a singleton approach meaning that 2 message of the same type is not allowed to be ...
Magnus Gladh's user avatar
  • 1,837
1 vote
2 answers
55 views

Problem with updating the table via UPDATE SELECT

I'm using MS SQL Server. I have 2 tables: Table1 stores information about the individual object number (Object_id), the number of its property (Prop_id) and the value of this property (Value). Example ...
Twinkles's user avatar
1 vote
1 answer
116 views

Inserting and updating records at the same time

I have got the following Postgres table: create table test ( id serial, contract varchar, amount int, aggregated int, is_aggregate int ); insert into test (contract, amount, ...
Westcoaster's user avatar
1 vote
2 answers
76 views

Updating data and casting to new datatype

I'm working on Google BigQuery to analyze sample movie data. The movie ratings are stored with spaces between the number and decimal point, so when I uplaoded the CSV file, Google BigQuery stored them ...
beth_9's user avatar
  • 113
0 votes
1 answer
73 views

Update values in multiple columns in table AA with values in the same columns from table B but only if condition is met

I need to update the information in table AA with the information from table BB but only if AA=ID4 matches BB=ID4. Below is the current table layout: Before Update: Table AA ID1 ID2 ID3 ID4 ID5 ID6 ...
GB1975's user avatar
  • 1
0 votes
1 answer
35 views

SQL Update/Merge - how to get update statements that make source table unnecessary

I have a table Links with fields code (string) and link (string). Some of the links are NULL, so I need to update those values based a correct full mapping in excel (sheet has the same fields). Now, ...
Michael woof Randel's user avatar
0 votes
0 answers
26 views

MYSQL Truncate resulting in Wrong Calculations

When I run below: balance = TRUNCATE(19.91 + 0.08, 2) In an update operations into a mysql db, I get 19.98 as the result instead of 19.99. What could be causing this and how do i resolve it? I have ...
Kidd Kidd's user avatar
0 votes
1 answer
60 views

Update issue using join in SQLite

Good morning all, Apologies if this has been addressed, I am attempting to run the following query. I have duplicated my table in order to create a join. I have identified the null Propertyaddress in ...
S T's user avatar
  • 39

1
2 3 4 5
241