0

Inserting values in multiple rows at once

Hey guys if i have an empty column in addition to other columns ,so i want to insert data into the empty column for all the rows at once(not same values) Using only single query so is this possible?

1st Aug 2017, 6:33 PM
Suhail Pappu
Suhail Pappu - avatar
1 Antwort
0
SELECT t.*, CASE WHEN t.empty_column IS MISSING THEN x ELSE t.column END AS new_column FROM your_table t This code will certainly work for Sass and PSQL. Basically, the idea is that you place single value (x) in the new column (new_column) on every row that don't have a value in the original column (empty_column). You can opt for overwriting the original column by using: END AS t.empty_column For inserting NOT the same value you need to at least explain what values you want it to be. In general it's a good rule of thumb to provide the following information when asking questions: 1) dialect you're using 2) data structure you have 3) data structure you want
2nd Aug 2017, 8:00 PM
Lana
Lana - avatar