通过子查询计算查询两列的差
convert使用按中文排序
locate类似于like
round保留2位小数
using指定字符集using指定utf8时防止乱码
select temp. deposit,temp.prepayment,(temp.prepayment-temp. deposit)availableMoney from(select round(ifnull(deposit,0),2)deposit,round(ifnull(prepayment,0),2)prepayment from encounter where 1=1 and (locate('哈',customer_name)>0 or locate('哈',room_no) or locate('哈',bed_no)) order by convert(customer_name using gbk) asc)temp