logo

:: Adding $ sign to MySQL output ::

Question:

In my MySQL query I have:

SELECT price FROM stock;

How can I get add the $ sign in front of the price?


Answer:

Use the function called CONCAT() to concatenate strings.
e.g.: SELECT CONCAT('$', CAST(price AS char)) AS price FROM stock;

<< Back to Questions and Answers

© Copyright php-etc.com 2010. Please contact the webmaster for all enquiries.