2

I would like to add a value (concatenate) at the end of existing values in a column of sqlite table. ie: the column contains : banana, orange, pear, pinapple I want to add lemon at the end of the column to have : banana, orange, pear, pinapple, lemon

forpas
  • 160,666
  • 10
  • 38
  • 76
moi
  • 45
  • 1
  • 4

2 Answers2

2

Use the concatenation operator || in the update statement:

update tablename
set columnname = columnname || ', lemon'
where columnname = 'banana, orange, pear, pinapple'

or:

where <some other condition>   

Replace tablename and columnname with your table's and column's names.
If you want to update all the rows of the table remove the where clause.

forpas
  • 160,666
  • 10
  • 38
  • 76
0

Is perhaps this answer here at SO the right one?

So in a table "groceries" with a column fruits "banana, orange" like

SELECT fruits || ', lemon' FROM groceries

this would yield

banana, orange, lemon
Dennis Proksch
  • 240
  • 2
  • 9
  • My question was not clear :( ...I updated it by replacing "row" with "column". The column contains : banana, orange, pear, pinapple and I want to add lemon at the end – moi Sep 03 '19 at 17:36