Linked Questions

0 votes
1 answer
1k views

UPDATE Customer C SET name = B.name, age = B.age FROM (SELECT A.*, B.* FROM CUSTOMER_TEMP WHERE A.ID = B.ID) AS B I got a sql as above, after I run the query, it update all my rows to the same result....
Hann Sze Enn's user avatar
0 votes
0 answers
47 views

UPDATE A,B SET A.a = 'something' WHERE A.b = B.b AND A.c = B.C; I have this code inside a function in sql, but it doesn't work. I fill table B inside the function but first of all when I want to use ...
biomary's user avatar
1698 votes
18 answers
2.4m views

I need to update this table in SQL Server with data from its 'parent' table, see below: Table: sale id (int) udid (int) assid (int) Table: ud id (int) assid (int) sale.assid contains the correct ...
Ant Swift's user avatar
  • 21.4k
1570 votes
14 answers
1.9m views

Given two data frames: df1 = data.frame(CustomerId = c(1:6), Product = c(rep("Toaster", 3), rep("Radio", 3))) df2 = data.frame(CustomerId = c(2, 4, 6), State = c(rep("Alabama&...
Dan Goldstein's user avatar
59 votes
5 answers
19k views

So I am trying to update my model by running the following: FooBar.objects.filter(something=True).update(foobar=F('foo__bar')) but I get the following error: FieldError: Joined field references are ...
Ryan Saxe's user avatar
  • 17.9k
7 votes
1 answer
6k views

I am trying to write a sql statement to update a column of a table from another tables column. But I only want to update the column if its empty. For example: UPDATE Table SET Table.col1 = ...
add-semi-colons's user avatar
1 vote
1 answer
2k views

I am trying to update a set of rows which needs to be filtered by a JOIN to another table but which will not be doing the actual update. Example: The table to be update is called t2 It has a master ...
eurosoll's user avatar
0 votes
1 answer
2k views

I have 2 tables wherein I need the result as follows : If the country name is 'United States' then the region should be hardcoded as 'Mexico' & if the country name is 'Taiwan' then the region ...
user1538020's user avatar
0 votes
1 answer
896 views

I can't figure out how to do this in Postgres. I have two tables, foo and bar: foo:id, number bar:id, foo_id There is an entry in bar that corresponds to and entry in foo. I want to update foo and ...
Alexander Kleinhans's user avatar
0 votes
4 answers
185 views

I want to update multiple rows. I have a lot of ids that specify which row to update (around 12k ids). What would be the best way to achieve this? I know I could do UPDATE table SET col="value" ...
xNidhogg's user avatar
  • 341
0 votes
0 answers
478 views

I am trying to map a contributor_id in my archive table to a contributor_id in my sales table. The archive table has 120k entries and the sales table has 20k. The sales table has an '...
GeneralBear's user avatar
  • 1,021
0 votes
1 answer
329 views

I need to write a Postgres script to loop over all the rows I have in a particular table, get the date column in that row, find all rows in a different table that have that date and assign that row ...
b0xxed1n's user avatar
  • 2,384
0 votes
1 answer
395 views

A pretty simple Spring application made to run using different DataSources. In it I have a liquibase change-set which involves this sql: <sql> UPDATE home_description hd INNER JOIN home h ...
Deniss M.'s user avatar
  • 4,140
1 vote
1 answer
288 views

My problem is I got 2 table 1 is coach and 1 is tool coach (cid, forename, surname, toolNo ) tool (toolNo , registNo ) I want to change the coach "Will Smith" 's toolNo to 10 by using the registNo. ...
yoadle's user avatar
  • 188
0 votes
2 answers
158 views

I have an update query in postgres as such: update table1 e set (col1,col2) = (select col1,col2 from table2 se where e.id = se.id and se.col2 is not null); However this updates all rows even the ...
moth's user avatar
  • 2,459

15 30 50 per page