1.spark sql 计算时,一定要注意精度的问题,一般像金额之类的值,要先转换为double或者 decimal来进行计算了. 一.sql的方式:select shop_id,order_id,sum(cast(deal_price as decimal(15,2))) deal_price,sum(cast(total_price as decimal(15,2))) total_price from aaa where stat_day='20190617' and cid1 not i
在做交叉报表列头的排序时,遇到这三个问题,下面具体来说一下. 设计的数据库的表结构如图1所示: 图1 要处出来student_name_,s.grade_,s.subject_name_,这三个属性,当时我是这样写的sql语句: select s.student_name_, s.grade_, s.subject_name_, case s.subject_name_ when '语文' then 'A语文' when '数学' then 'B数学' when '英语' then
/** *判断字符类型 */ function CharMode(iN) { if (iN >= 48 && iN <= 57) //数字 return 1; if (iN >= 65 && iN <= 90) //大写字母 return 2; if (iN >= 97 && iN <= 122) //小写 return 4; else return 8; //特殊字符 } /** * 统计字符类型 */ function