mySQL format number output , thousands separator

时光毁灭记忆、已成空白 提交于 2019-12-06 04:31:57

Just use ROUND, this is a numeric function. FORMAT is a string function

ROUND(Fixes.GBPam, 3)

you can use replace command for this purpose.

 REPLACE(Fixes.GBPam,',','')

EDIT: With respect to your question you could do something like this:

SELECT Metals.Metal, ROUND(REPLACE(Fixes.GBPam,',',''),3) AS AM,
  ROUND(REPLACE(Fixes.GBPpm,',',''),3) AS PM,     
  DATE_FORMAT(Fixes.DateTime, '%d-%m-%y') AS Date
  FROM Fixes, Metals
WHERE Metals.Id = Fixes.Metals_Id 
Sundar G

Use replace function. Whether the field is integer or varchar, it will work.

select replace(Fixes.GBPam,',','.');
易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!