数据测试总结

问题:

mysql  语法 转 hql 语法过程遇到的问题:

  1. int 类型和 字符串类型比较大小 ,
    1. 比如表中是int 类型  10 <  '1'   或者   '10' > 1  ,常见与 where  后写法
  2. 类型转换问题  ; 
    1.   sum(  cast(  case when channel_code='1' then  ' '  else qty end as int  )  )  ;  
  3. 字符类型/null  和  Int 类型进行加减操作 ; 
    1. null +1 ,    ' 1 ' + 2 , ' '+ 1  ,
    2.  case  when true then qty  end   缺少了 else 默认为null ,后续在进行计算时抛错 
    3. coalesce(a.qty,b.qty)  缺少默认值 
  4.  分母为0 的问题 ;
    1. 1/sum(col)
    2. 1/col
    3. 1/cast(  case when channel_code='1' then  ' '  else qty end as int  )  )

案例1:

 

案例2 :

 

posted @ 2022-11-08 19:09  linbo.yang  阅读(32)  评论(0编辑  收藏  举报