Jump to content


Photo

modify data on select


  • This topic is locked This topic is locked
1 reply to this topic

#1 hvle

hvle
  • Members
  • PipPipPip
  • Advanced Member
  • 667 posts
  • Locationmelbourne, Australia

Posted 06 August 2006 - 03:54 PM

I have a table contain a field named 'price' and it is a numeric data.
That field, as you know, hold a numeric number represent an amount of money.

when I do: "select price from table where 1"
it will return the price in numeric form:

234.30
200.00

etc.

The question is, how can I set the query so that it will return

$234.30
$200.00

instead.
how can I have mysql to insert a dollar sign before the data upon return the result?

Thank you very much in advance.

Life's too short for arguing.

#2 hvle

hvle
  • Members
  • PipPipPip
  • Advanced Member
  • 667 posts
  • Locationmelbourne, Australia

Posted 06 August 2006 - 04:03 PM

actually, i just found the solution from the manual:

select concat('$',price) as price

Thanks
Life's too short for arguing.




0 user(s) are reading this topic

0 members, 0 guests, 0 anonymous users