問題:
mysql 語法 轉 hql 語法過程遇到的問題:
- int 類型和 字符串類型比較大小 ,
- 比如表中是int 類型 10 < '1' 或者 '10' > 1 ,常見與 where 後寫法
- 類型轉換問題 ;
- sum( cast( case when channel_code='1' then ' ' else qty end as int ) ) ;
- 字符類型/null 和 Int 類型進行加減操作 ;
- null +1 , ' 1 ' + 2 , ' '+ 1 ,
- case when true then qty end 缺少了 else 默認爲null ,後續在進行計算時拋錯
- coalesce(a.qty,b.qty) 缺少默認值
- 分母爲0 的問題 ;
- 1/sum(col)
- 1/col
- 1/cast( case when channel_code='1' then ' ' else qty end as int ) )
案例1:
案例2 :