"Appel" <ap***@starnet-it.de> wrote in message news:<2u*************@uni-berlin.de>...
Hallo
i have a problem to add to string with a SQL statement.
My Table : Tablename NAMES:
| Name1 | Name2 | Name3 |
John Meyer
I search for a SQL statment that update Name3.
The statemant must add Name1 with Name2 and put the result into Name3
| Name1 | Name2 | Name3 |
John Meyer John Meyer
I have use :
update NAMES SET Name3=Name1+Name2
but it don't works.
Can anybody help me ?
UPDATE names SET name3 = TRIM(name1) || ' ' || TRIM(name2)
But do you really want to store the same information twice?
Its a waste of memory, but even more important is the risk of data
inconsistency. Typically somebody inserts or updates name1 or name2,
but forgets to update name3.
You can perhaps use a view:
CREATE VIEW namesview (name1, name2, name3) AS
SELECT name1, name2, TRIM(name1) || ' ' || TRIM(name2)
FROM names
HTH,
Jarl