After removal of excess MySQL database in decimal 0

About the amount of field, stored in the database is a decimal (18,4), so after decimal point data stored there will be a function of some "extra" 0, page impressions do not want to display these "extra" 0, so use the mysql deal with.

Specific processing is as follows:

Table structure is as follows:

Untreated results are as follows:

SELECT t.loan_rate, t.current_period, t.other_cost
  FROM t_cd_agent_loan_info t 
 WHERE t.`id` = '72' 
 ORDER BY t.id DESC;


After treatment the following functions:


SELECT 0 + CAST(t.loan_rate AS CHAR) , 
       0 + CAST(t.current_period AS CHAR) , 
       0 + CAST(t.other_cost AS CHAR) 
  FROM t_cd_agent_loan_info t 
 WHERE t.id = '72' 
 ORDER BY t.id DESC;

Thumbs
Favorite
Share

Lin millet
released 28 original articles won praise · 90 · views 180 000
+ ----------------
Disclaimer: This article is the original article CSDN bloggers "Lin millet", and follow CC 4.0 BY-SA copyright agreement, reproduced, please attach the original source link and this statement.
Original link: https: //blog.csdn.net/oXinLiang12/article/details/78481018

Published 51 original articles · won praise 80 · views 930 000 +

Guess you like

Origin blog.csdn.net/xiyang_1990/article/details/103580198