[ Keyframe @ 04.07.2006. 13:36 ] @
ako se moze napraviti query SELECT 2+2, i izbaci field 2+2 sa vrijednosti 4

pa ako se moze i recimo SELECT foo+1 FROM table, ako je foo int - pa pridoda 1 svim intovima

kako napraviti da ako je foo text field, da se pridoda vrijednost na pocetak ili na kraj fielda.. nesto tipa SELECT 'pretekst'+foo+'posttekst' FROM table - naravno, ovaj query ne radi
[ NikolaVeber @ 04.07.2006. 14:06 ] @
Citat:
#

CONCAT(str1,str2,...)

Returns the string that results from concatenating the arguments. May have one or more arguments. If all arguments are non-binary strings, the result is a non-binary string. If the arguments include any binary strings, the result is a binary string. A numeric argument is converted to its equivalent binary string form; if you want to avoid that, you can use an explicit type cast, as in this example:

SELECT CONCAT(CAST(int_col AS CHAR), char_col);

CONCAT() returns NULL if any argument is NULL.

mysql> SELECT CONCAT('My', 'S', 'QL');
-> 'MySQL'
mysql> SELECT CONCAT('My', NULL, 'QL');
-> NULL
mysql> SELECT CONCAT(14.3);
-> '14.3'

#

CONCAT_WS(separator,str1,str2,...)

CONCAT_WS() stands for Concatenate With Separator and is a special form of CONCAT(). The first argument is the separator for the rest of the arguments. The separator is added between the strings to be concatenated. The separator can be a string, as can the rest of the arguments. If the separator is NULL, the result is NULL.

mysql> SELECT CONCAT_WS(',','First name','Second name','Last Name');
-> 'First name,Second name,Last Name'
mysql> SELECT CONCAT_WS(',','First name',NULL,'Last Name');
-> 'First name,Last Name'

CONCAT_WS() does not skip empty strings. However, it does skip any NULL values after the separator argument.
[ Keyframe @ 04.07.2006. 14:11 ] @
to care, puno hvala!