DKean
DKean

Reputation: 2099

how to convert numerics to strings in the select statement of mySQL

Is is possible to convert a numeric and date to string as you issue a SELECT statement in MySQL? Something like this:

SELECT str(a.Amount) as AMT, str(a.date) as Date FROM LALAZUK as a...

Upvotes: 0

Views: 134

Answers (1)

philwinkle
philwinkle

Reputation: 7056

What you need is CAST:

SELECT CAST(a.Amount AS CHAR CHARACTER SET utf8) as AMT, SELECT CAST(a.date AS CHAR CHARACTER SET utf8) as Date FROM LALAZUK as a...

http://dev.mysql.com/doc/refman/5.0/en/charset-convert.html

Upvotes: 3

Related Questions