Return modified value
-
Hi All, I need to return a value with a string appended on the front of it, but I don't want to modify the table. is this possible with mysql? Eg:
SELECT type FROM table
Currently returns: "basket" and "cart" But I'd like it to return: "Shopping basket" and "Shopping Cart" (appends "Shopping " before the returned each of the returned values). I thought I could use the CONCAT function but that doesn't seem to work. Any ideas?
-
Hi All, I need to return a value with a string appended on the front of it, but I don't want to modify the table. is this possible with mysql? Eg:
SELECT type FROM table
Currently returns: "basket" and "cart" But I'd like it to return: "Shopping basket" and "Shopping Cart" (appends "Shopping " before the returned each of the returned values). I thought I could use the CONCAT function but that doesn't seem to work. Any ideas?
Hi Marc, this should do it:
SELECT CONCAT('Shopping ',type) AS type FROM table
:)
Luc Pattyn
I only read code that is properly indented, and rendered in a non-proportional font; hint: use PRE tags in forum messages
-
Hi Marc, this should do it:
SELECT CONCAT('Shopping ',type) AS type FROM table
:)
Luc Pattyn
I only read code that is properly indented, and rendered in a non-proportional font; hint: use PRE tags in forum messages
Yup. Fantastic Thanks.