Most voted "sql-update" questions
Update is an SQL statement that changes the data of one or more records in a table, as well as a subset of results, and can also be filtered by conditions.
Learn more…270 questions
Sort by count of
-
39
votes1
answer20752
viewsIs it possible to do an UPDATE with data from another table?
I know it’s possible to execute one INSERT with data from another table: INSERT INTO Tabela (Col01, Col02, Col03) SELECT Col01, Col02, Col03 FROM Outra_tabela WHERE Condicao = 'qualquer coisa' But…
-
11
votes2
answers2353
viewsWhen should I inactivate or delete a record? Good database practices
I have the following doubt: When should I inactivate a record? When should I delete a record? In case you would like a good practice tip, in which tables it pays to create a STATUS column? Being the…
-
10
votes2
answers341
viewsError updating the entire JAVA table
I’m trying to perform a mass update to update all prices of products registered in the system, adding the value passed by the user to the unit price of the registered product, according to the…
-
10
votes2
answers413
viewsUpdate with Case When you need Where?
UPDATE bethadba.FOFILHOS SET CPF = CASE WHEN CODI_EMP = 61 AND I_EMPREGADOS = 156 AND i_filhos = 1 THEN '00551366133' WHEN CODI_EMP = 57 AND I_EMPREGADOS = 290 AND i_filhos = 1 THEN '00636170993'…
-
8
votes6
answers1639
viewsRemove an undetermined number of " " in a column in the database
The field description on the table product contains HTML generated by Ckeditor (English) that tries to escape the content: <table…
-
7
votes4
answers19788
viewsHow do I update with a Join?
Hello, I’m new to the forum and I need some help with SGBD Postgresql. My doubt 'and the following, in the following code used in DBMS Mysql the execution happens perfectly, by'em in Postgresql…
-
7
votes1
answer121
viewsIs it possible to change more than one record at a time?
That is the code: UPDATE PESSOAS SET COR = ('Pardo') WHERE ID = 1; But I have 2 more records to do the same procedure, I could do everything at once adding the ID?…
-
6
votes3
answers269
viewsHow to search and save a single field?
How can I search a single field of the table change it and save this field without having to search all fields of the table? The reason for this is simple, I have some tables that have more than 30…
-
5
votes1
answer625
viewsHow to update fields with fields from another table?
I’m not able to update one table with another’s select. I have a table mdl_user which contains several columns and created another users_sg to copy some columns. I copied with INSERT INTO users_sg…
-
5
votes1
answer147
viewsError doing UPDATE when setting varbinary variable as`null`
Follows code: var file = Request.Files; var list = new List<byte[]>(); for (int i = 0; i < 4; i++) { if (file.Count > i) { list.Add(ConvertTo.Bytes(file[i])); continue; } list.Add(null);…
-
4
votes1
answer58
viewsHow to update the value of a column by substituting in all rows of the table?
I have a table i18n in the database whose column constant contains all values with prefix lang: Description of the table…
-
4
votes1
answer164
viewsInvert 0 or 1 in a column
I have a table that has numerous records and a column called posição. It only gets the value 0 for locked and 1 for released. There now with a change I need to reverse these values, where this 0 has…
-
4
votes2
answers1422
viewsUpdate the information on the page when making a change in the BD
Let’s say I have button value="+1" on my page, and every time I click on that button is updated in the database, the page refreshes and displayed a message of success or error. This update process…
-
4
votes3
answers3103
viewsHow to perform UPDATE with ORDER BY on sql server?
I would like to perform an update ordering the results of the same, for this I wanted to run an update like this: UPDATE pessoa SET nome = 'Jose' WHERE sobrenome LIKE '%Betalla%' ORDER BY nome But…
-
4
votes2
answers1474
viewsIs it possible to do an INSERT and UPDATE in the same query in java?
I wonder if it is possible to make one INSERT and a UPDATE in the same query, that is, in the same operation. I’m using the following to do both operations. public Connection conn = null; ... conn =…
-
3
votes1
answer475
views"Linked Server" with Mysql
DBMS: SQL SERVER 2014 + Mysql 5.5 What are the syntax of SELECT, INSERT and UPDATE instead of using the "OPENQUERY" function, when connecting through the SQL SERVER Linked Server, connecting in…
-
3
votes1
answer169
viewsAdd value to SQL table instead of replacing
Using the following code: UPDATE `login` SET diasvip = '".+$_POST["qntvip"]."' WHERE userid = '".$_POST["userid"]."' When I execute, it replaces the diasvip by the value posted instead of adding the…
-
3
votes1
answer967
viewsUpdate to remove a piece of a varchar field
I have a column with a varchar field. In this column has a value like this: http://dominio/img//12.jpg I want to do an update that leaves this field like this: http://dominio/img/12.jpg That // I…
-
3
votes1
answer872
viewsChange Mysql column information with UPDATE
In summary through PHP below I can send the specific information already recorded in the column in the BD, only that, in addition to just "sending" the data there, I would like a function that…
-
3
votes1
answer961
viewsI need to change only half the records of a Mysql table
I made this Procedure in Mysql to change a record only half of the table but it produces an unexplained error: It seems the trouble is in the LIMIT who refuses to accept a variable. On the Sqlserver…
-
3
votes1
answer2557
viewsRemove spaces via Update
I have a field called titulo, on the table noticias. Unfortunately, due to forgetting the command trim PHP, has several titles with space at the beginning and end of string. How can via SQL (Mysql)…
-
3
votes1
answer62
viewscolumn does not obey the Where command of an update
I have a problem. At the moment I make an update, when I use Where only the line with the code informed is updated. however the Description field that I report, its content is replicated for all…
-
3
votes2
answers100
viewsUPDATE giving error but updates database
I’m creating a page of login where I need to save to the Mysql database the date and time when the login user. In the database I have a table like this:…
-
3
votes1
answer505
viewsUpdate in two SQL Server tables
How do I perform an update at the same time on two different tables? I have a table called Tarefa and another call VinculoReferencia, both have the field Taridinclusao where is this field that needs…
-
3
votes1
answer774
viewsCRUD PHP No update, no error
I’m having problems when I try to run an UPDATE on my system in PHP + Mysql. I have the file code edit: <?php require_once 'init.php'; // resgata os valores do formulario $nome =…
-
3
votes1
answer54
viewsWhat is the cost of an update when it does not find the record?
I’m doing some Sqls in my Delphi program and I came up with this question, what is the cost to the bank engine when a UPDATE does not find the record according to the parameters of WHERE? My…
-
3
votes1
answer72
viewsCondition of a query with an under-consumption
I need to update the last 110 table records relevo, but my problem lies in the current WHERE. I’m doing it this way: UPDATE relevo SET id_projeto = 157 WHERE id_relevo = (SELECT id_relevo FROM…
-
3
votes1
answer2143
viewsUpdate - Firebird with Inner Join
I need to perform an Update on multiple records at the same time, I’m trying to optimize the process! SELECT tei.id_identificador, tes.uni_medida, tep.qtd_atual FROM tb_estoque tes INNER JOIN…
-
2
votes1
answer81
viewsUPDATE, field with "placeholder query" failed execution
Follows the code: $campo = $_POST['campo']; $valor = $_POST['valor']; $id = $_POST['id']; $mysqli = new mysqli("localhost","root","","tabela"); mysqli_set_charset($mysqli,"utf8"); $consulta =…
-
2
votes1
answer759
viewsUpdate by changing one value by the other in the table
Which update would use to change one value by the other in a table. A update on the table produtos spine cod_produto. I would like a query where in the call table produtos all contained in the…
-
2
votes1
answer381
viewsHow do I save the value to decimals before the point in sql server?
I have a field in the bank with this format TESTE numeric(8, 3) I want to record this form. UPDATE TB_PLANO_CONTAS SET TESTE = 001.000 WHERE IDPLANOCONTAS = 63 The result is getting like this: 1,000…
-
2
votes1
answer167
viewsHow to keep data up to date in two tables?
There are two tables that should be kept updated in different databases, "user" of the "DB1" and "user" of the "DB2" database. In this case, it would be the "password" field to be updated. I have a…
-
2
votes1
answer227
viewsError updating a table. (Duplicate key)
Good. When doing the update give me error.. Yes ja la I have a record in the table with those values, but when changing the type should not let me do?…
-
2
votes1
answer2360
viewsUpdate several fields and values in the same table
I’m making a very simple system for inventory control, and in the part of editing the products, I’m doing it this way: I do a query in a database, and I list text fields with the name of the…
-
2
votes0
answers428
viewsHow to make a DLC-like update with Unity
Hello! I would like to know if it is possible, create an update for a game (IOS/Android) type DLC, ie the user will have the option to include this extension to his current game. I have tested with…
-
2
votes2
answers644
viewsError in select with PHP + Mysqli
I’m trying to use a query to pull one ID specific that comes from another page. I can receive the ID for $_GET, i printed the query to see if it was right, even so of the error and does not show me…
-
2
votes2
answers2141
viewsUPDATE in multiple tables with the same column?
Let’s imagine a scenario where I need to give a update in 10 different tables in the same column in all of them updating a certain data, the syntax below will work? UPDATE tab1, tab2, tab3... SET…
-
2
votes3
answers849
viewsHow to go through each row of the database compare and update a specific column?
I have a table called PRODUCT and I need to make a comparison between two columns, the column DATA_INICIAL AND DATA_FINAL, for each row travelled, if the product is not in agreement should enter the…
-
2
votes1
answer822
viewsUpdate in more than one line
I’m trying to ride a update thus: UPDATE cad_vendas SET canal ='9', parceiro ='9' WHERE cpf_vendedor ='CPF_VENDEDOR' and status_proposta_producao ='90' and forma_pagamento <> ''; but he won’t…
-
2
votes2
answers1036
viewsUPDATE in two PHP tables
In my database I have a table called register id_cadastro name_user email_user idade_user overuser fb_user tt_user in_user avatar_user This is the information I use for logging in. However, after…
-
2
votes4
answers2768
viewsHow do I enter a value in every record in a column of a table?
I have the table 'category' and a column 'id', and this column has more than 100 records. How do I add a value to all these records? In case the value would be '3'.
-
2
votes1
answer723
viewsUpdate in Database by c#
I’m trying to update my database by visual Studio(c#), but the update is not being carried out I don’t know why. Table script(sql developer): CREATE TABLE Login ( Cod_login NUMBER(8) NOT NULL,…
-
2
votes2
answers521
viewsCheck duplicate items and update a column in all but one
I have a table of products that bring information from an XML, and another table in the system that basically receives these products after approval (we have an interface to define what enters or…
-
2
votes1
answer442
viewsUpdate table field only marked with php mysql checkbox
@Leo Caracciolo worked out the way you did in this post here, but I have another problem: there are students who are enrolled in several courses, ie the student id is the same , but the course id in…
-
2
votes2
answers2109
viewsUpdate with the SET of another table
I’m trying to update with JOIN... The following instruction was just a kick to get the idea of what I want to do: UPDATE PCPSEQPROC_001 PCPSEQPROC SET PCPSEQPROC.ID_PCPSEQPROC = PCPSEQ.ID_PCPSEQ…
-
2
votes2
answers418
viewsProblem with Table UPDATE based on summation of another table
Greetings to all of the forum! Like everyone who starts learning Mysql, we come across relatively simple problems but we can’t solve. I created the INFO_PACOTES table that stores information of…
-
2
votes2
answers161
viewsUpdate in three tables
Good morning, I wonder if it is possible to update in three tables at once? I have the A, booklet, booklet, which are listed by the id_book column, and I would like to change the value of the book…
-
2
votes1
answer746
viewssplit 1 column into 2 in sql server giving update
I use SQL Server 2012 I have the following problem, in a table there are records of municipalities and two respective Fus but there is the need to divide this column into 2 one of municipality and…
-
2
votes3
answers818
viewsUpdate does not work
In my system has a registration page and a page with a table with the information of registered. In this table there is an edit button that links with an equal form of the registration page. What…
-
2
votes2
answers409
viewsSELECT AND UPDATE - Undefined index when submitting form
Hello I am building a content manager and I have a page where I return the results of the chosen country, so I can then update each field. When choosing each country on the Countries.php page, I…