MySQL数据类型转换函数CAST与CONVERT的用法

Posted 小小飞侠

tags:

篇首语:本文由小常识网(cha138.com)小编为大家整理,主要介绍了MySQL数据类型转换函数CAST与CONVERT的用法相关的知识,希望对你有一定的参考价值。

<!-- 获取当前城市的所有推荐商户 -->
<select id="findAllRecommendSupplier" resultType="java.util.Map">
SELECT s.supplier_id AS supplierId ,s.main_products AS mainProducts
,s.group_id AS groupId,s.head_url AS supplierHead,
s.repair_center_name AS repairCenterName,s.shop_url AS shopUrl
,s.manager_phone AS managerPhone, s.service_tel AS serviceTel,
s.pro_name AS proName ,s.city_name AS cityName ,s.area_name AS
areaName ,s.detailed ,shop_profile AS shopProfile,s.company AS
supplierName,s.head_url AS headUrl
FROM w_supplier_sort w
LEFT JOIN s_supplier s ON w.supplier_id = s.supplier_id
LEFT JOIN s_user u ON w.supplier_id = u.id
WHERE s.city_number = #{cityNumber,jdbcType=VARCHAR} AND
UNIX_TIMESTAMP(NOW())*1000 &lt; s.end_time
AND s.main_products is not NULL AND u.user_state = 0 AND u.account_state = 0
ORDER BY convert((sell_number /#{sellSum,jdbcType=BIGINT} * #{sellFaciend,jdbcType=DECIMAL} +
call_number/#{callSum,jdbcType=BIGINT} * #{callFaciend,jdbcType=DECIMAL}),decimal(18,10))
DESC
</select>

以上是关于MySQL数据类型转换函数CAST与CONVERT的用法的主要内容,如果未能解决你的问题,请参考以下文章

MySQL CAST与CONVERT 函数的用法

mysql类型转换函数使用小记

mysql类型转换函数使用小记

mysql类型转换函数使用小记

MySQL - 类型转换函数:CONVERT & CAST

MySQL 数据类型转换