Newest 'sql-update' Questions

Q&A for professional and enthusiast programmers

How to add running ID in a single UPDATE statement (Oracle)

let's assume I have a table tab1 in my Oracle DB 12.1, which has a column record_id (type NUMBER) and many other columns, among them a column named exchg_id. This record_id is always empty when a ...

How would I create a proper UPDATE statement

I have to update Lseq field in Table_A with values from Table_B seq field. TABLE_A ID | OrderNumber | Lseq | SKU | CustOrdNumber ----+--------------+------+------+--------------- 523 ...

Bulk update MySQL table with data concatenated from another table

This isn't WordPress specific, but it's worth noting that it's a WP db I'm working with... I need to update the posts table value post_title for all entries with post_type='appearance'. The current ...

How to update in db2 with join

I want to do an update, updating only the values affected, but my update query has a join, so where exists won't work. update semester_workload tA set tA.account = (SELECT DISTINCT (t2.WORKING - t2....

PHP, MySQL Update multiple columns

$mengetotzut = 7','8','9','22','23','24','25 ; $zutatiddd = 42','75','8','90','23','82','33 ; $sql5= "UPDATE zutaten SET Menge=('$mengetotzut') WHERE Zutat_ID IN('$zutatiddd')"; $run_query = ...

Setting modifed flag in recordset based on previous row with mysql

I have the following table post pk id title title_mod author author_mod -------------------------------------------------------------------- 001 1 Foo Bar ...

Using Checkboxes to Update a MySql Database

Ok, I know I'll probably get bashed for even asking this... its been about 5-6 years since I've touched PHP and MySql, so I think I may be overthinking all of this. I have an HTML form, that is a ...

Update multiple columns where values are from different tables - Oracle

I need to update multiple columns in the same table. However, the values I need to update to are coming from different tables. I currently have the update statements separated. The problem is I have a ...

How to use UPDATE command in spark-sql & DataFrames

I am trying to implement UPDATE command on DataFrames in spark. But getting this error. Please put suggestions on what should be done. 17/01/19 11:49:39 INFO Replace$: query --> UPDATE temp SET c2 ...

How do I make my SQL duplicate query make sure all columns match?

I currently have a SQL query that seems to only take one column at a time and search for dupes. So for example if we have two records with the FIRST = 'Charles' but both of their last names are ...

How can I update a table by using subquery

I have got table which is "Stocks". There are thousands of records inside of this table and I need to UPDATE it acc. to following Example. (I use SQL Server 2008) STOCKS.stock_name STOCKS.a_id A....

UPDATE Record in one table, with data from another table (seperate DB's) SSMS

I'm trying to create a script that I can use to resolve an issue with replication we experience in our Database structure. Users will create a Master record in a Master database, and replication is ...

SQL Update a table from same table join

Below is 2 views of same table "TablePDF" I need a UPDATE statement that can join the 2 views based on same table and update the T_File column in View1 with the value of T_FILE in View2 CustOrdNumber =...

Trigger to update a linked server table when specific values are entered

I'm synchronizing two separate database applications. The databases are linked servers. One is a CRM and one is an ERP. When the user enters one of three code strings in the quates table status column ...

Error You have an error in your SQL syntax

<?php include("../database/config.php"); if(isset($_POST['btn_submit'])){ $sql = ("UPDATE pelajar SET nama = '".$_POST['nama']."', pelajar_ic = '".$_POST['pelajar_ic']."', nama_kelas = '"....

SQL Update for Selected rows

I have this SQL Code: SELECT * FROM `clients_branches` WHERE NULLIF(clients_branches.invoice_email, '') IS NULL GROUP BY client_code HAVING COUNT(*) = 1 It returns all ...

Does MySQL update the same row one at a time?

If I run ten update queries like this, at the exact same time: update table set x = x - 1 where x >= 1 Does MySQL, under repeatable-read mode, guarantee that all these update queries are run one ...

Update MySQl Linked server from sql server trigger

Error I get when I run OLE DB provider "MSDASQL" for linked server "WEBSTAGING" returned message "[MySQL][ODBC 5.3(w) Driver]Optional feature not supported". Msg 7391, Level 16, State 2, ...

change data from database using php

I want to change data from a database but I keep getting errors and I just cannot find the mistake I made.. Here's the code: if(isset($_POST['id'])) { if(is_numeric($_POST['id'])) { ...

how to add or subtract a value from a column in oracle

i am trying to create an update oracle procedure that updates a column after a change has been made. Mass | SLAB | Mass Decreased/Increase 1100 | 200 | 100 // mass increased by 100 1000 ...

Update Oracle BLOB value in a batch

I'm trying to update a series of BLOB values using the following code. Note how we're not using Blob objects, but just calling setBytes. try (PreparedStatement p = c.prepareStatement("UPDATE table ...

SQL update, compare and foreign key

I added a foreign key id_customer into my table comment. But now I need to synchronize this foreign key id_customer with the primary key into customer table. For that I compare emails into customer ...

Update several rows simultaneously SQL server

I'm in the process of creating a table that lists cities, state, zip, and long/lat. I've created another column (called GeoLoc) in my table that uses the geography data type. I would like to combine ...

UPDATE a non primary key column - duplicate key value violates unique constraint

I need some help. I want to update a column value for all records. This column is new (created with alter table) and has no constraint. But, when executing: UPDATE mytable SET active = false The ...

Running UPDATE Query through Ajax on Save

I have a form with multiple different inputs. Two parts of the form are a dropdown box and three contact info input boxes. Whenever I make a selection in my dropdown box, it auto-populates information ...

UPDATE query in php with non POST variables

I'm trying to update a row in my database using two variables, which are not obtained from POST. It seems that everything works fine, both on the server side (PHP, and i checked with POSTMAN) and on ...

I receive multiple errors in SQL Server when trying to update a column in one table with a column for another

I have two tables dim_distributor and distributor_variant. There is a distributorvariantname column in distributor_variant, and a distributorname column in dim_distributor that should contain ...

android update record and requery

Developing an application that displays data retrieved from it's database in the initial screen. Users can edit the data via a separate edit screen. Exiting the edit screen returns the user to the ...

Updating mysql database using your findings in python

I am new to python so this might have wrong syntax as well. I want to bulk update my sql database. I have already created a column in the database with null values. My aim is to find the moving ...

sql update query giving bad Sql grammar Error [on hold]

Query String sql="update EMP set name='"+p.getName()+"', age="+p.getage()+",phone="+p.getphone()+",nationality='"+p.getnationality()+"',gender='"+p.getgender()+"',imgname='"+p.getImgname()+"',desc='"...

java - jsp update database row via form on submit

Hi im trying to update data from database using submit button , witch is located on a jsp page that shows data based on name and surname that you entered in login.jsp.. validationForDatabase.jsp ...

Multiple Update in one Mysql and PHP [duplicate]

$zutatid ='7','8','9','22','23','24','25'; $menge = '42','75','8','90','23','82','33'; UPDATE zutaten SET Menge ('42','75','8','90','23','82','33') WHERE Gericht_ID IN('7','8','9','22','23','24','...

How to update only matching columns in db2

I'm trying to do an update query that looks like this: update semester_workload tA set tA.working = (SELECT DEPUTAT_WS11 from TD_DOZENTEN t1 where t1.Pruefernummer = tA.ID_Lecturer AND tA....

When I add xx to mysql float column, it is wrong result, Is it a bug?

My mysql: 5.6.16 my table info : CREATE TABLE `xxx` ( `uid` int(11) NOT NULL, `money` float(10,2) NOT NULL DEFAULT '0.00' , `real_money` float(10,2) NOT NULL , `available_invoice` float(...

Trigger to update a linked server name record when specific values are enterred in status

Database Sql server 2008R I'm synchronizing two separate database applications. The databases are linked servers. One is a CRM and one is an ERP. When the user enters one of two code strings in the ...

Update or Insert rows from XML in SQL table using C#

I have an XML file how came from a machine with many parameters. Now i would like to store this parameters in my SQL Database. All times when i import a new XML file i need to check if the ID allready ...

How to use update from select in postgreSQL?

update users set users.przetwarzanie = historia_panel.zmiana_z from historia_panel where users.user_number like historia_panel.user_number and historia_panel.zmienna_zmieniana like '%...

Mysql Update with selection min/max count group

i have a simple table like this: id grouped type_error -- ------- ------------------ 1 1-0 TL 2 1-0 TL 3 1-0 TL 4 1-1 TL 5 ...

SQL UPDATE syntax to auto rearrange number

I have a very quick question. I have a series of orders where each order can have a priority. The priority can be either NULL or INT. Every now and then I want to arrange the priority back starting ...

How to update a new column with only a piece of text from another column - MySQL

I am trying to pull only part of the value from one column: "CI_Support_Remarks" to update another column "Asset_Number" in my table "CI_Information". If the data is currently stored as: "Asset#: ...

SQL: UPDATE TOP 3 wouldn't work?

I have this table1 and I want to update 3 of it where owner=0 now I've come cross TOP (number) but i doesn't seems to work out. tried TOP 3 tried TOP (3) here my line of code: mysqli_query($connect, ...

Modify a mysql record from PDO query results using php submit button

I have a php page that displays the results of a query. I want to have the ability to change a particular column from that results page. echo "<table> <tr> <th>First</th&...

How to update only affected columns on db2 while using join

I want to make an update in a table but only for the values affected, so I have to use where exists but apparently it won't work when using a join operation. Does anyone know why this happen and how ...

Update table entry by taking sum from another table in SQL Server 2008 R2

I am using SQL Server 2008 R2. I use the following query to see the sum of price times quantity for all the products in a package. select a.nid, a.packagename, case when sum(b....

Trigger to update anothe table

I have tblEarn id,tripid,dayearn. and tblbounce id, bounce I want to create trigger if the dayearn =>300 insert into tblbounc Bounce 30. Thanks

IsNull() sql function

I am attempting increment the value of a column field named "Number" by 1, and if the value is currently Null I would like to set the value to 1 because a Null value cannot be incremented. I ...

Update Item from same table where values are null

I have a table Member where their are duplicate entries and I want to remove one of them, but 1 of the entry has some columns updated and another has some other. So What I want to do is update but ...

Update query not updating all records

I have an update query to update records in a table, when i do a select on the criteria to be updated, it shows 715 records exist that match the condition but when I run the update query, only 15 of ...

Updating a empty column based on another column in the same table

I have a table point with the following (sample) data: datekey pointkey filter_key t_key ----------------------------------- (5506061, 37, NULL, 1), (5506061, 37, NULL,...

MySQL error code: 1175 during UPDATE (MySQL-Workbench vs. console)

Am very aware of that this issue can be resolved with disabling safe update mode enabled (e.g. see here: MySQL error code: 1175 during UPDATE in MySQL Workbench). However, I do not wish to disable ...
Translating... 0%