views:

41

answers:

2

I have two tables one called details and the other called c_details. Both tables are exact the same except for different table names

No I a row with data in both of these tables

Is it possible to update the row in details with the row in c_details

Eg.

update details SET (Select * from c_details)?

+1  A: 

INSERT INTO details SELECT * FROM c_details

ss
+2  A: 

You have to describe explicitly the list of columns to be updated, as well as the key to match columns between the two tables.

The syntax for updating one table from another table is described in detail in the UPDATE chapter of the PostgreSQL documentation.

UPDATE
  details
SET
  name = c.name,
  description = c.description
FROM
  c_details AS c
WHERE
  c.id=details.id;
Kouber Saparev