tags:

views:

61

answers:

3

i have two fields with a string in it, and i want a combination of those in a third field like:

UPDATE table SET field3=field1 . '_' . field2

what would be the right syntax for that? it is mysql

okay that CONCAT Thing worked, is there a function to convert those fields to lowercase??

A: 

In SQL Server:

UPDATE table SET field3 = field1 + '._.' + field2
Philip Kelley
A: 

What is your DBMS ? This could work :

UPDATE table SET field3=field1 || '_' || field2

in Oracle. In fact, '||' is the ANSI-SQL concatenation operator.

Scorpi0
+2  A: 

It depends on the database management system. In sql server would be:

UPDATE table SET field3 = field1 + '_' + field2

Whereas in Mysql it can be done with:

UPDATE table SET field3 = CONCAT_WS ('_', field1, field2)
despart
In MySQL you could also do CONCAT(field1, '_', field2)
Matt Bridges
nice, that works, is there also a function to convert the fields to lowercase?
Flo
okay LCASE just does fine, case closed
Flo