[MySQL] 解决mysql导出excel数值型变成科学计数法问题

当有数据导出需求的时候

我们直接写sql语句就能实现

但是有时候mysql中存储的数值太大了,在excel里面会变成科学计数法,如果超过了64位的话,那么还会丢失精度

需要在sql语句中concat 拼接一个\t

 

例如这样的sql里的

concat('\t',a.ding_userid),

select
  a.id,
  a.username,
  a.nickname,
  a.phone,
  a.create_time,
  d.name as store_name,
  a.status,
  a.work_types,
  CASE
    a.work_types
    WHEN "2,4" THEN '育婴师,保姆'
    WHEN "1,2,4" THEN '母婴护理师,育婴师,保姆'
    WHEN "3,11" THEN '催乳,产康'
    WHEN "1,2" THEN '母婴护理师,育婴师'
    WHEN "1,4" THEN '母婴护理师,保姆'
    WHEN "1,2,3,4" THEN '母婴护理师,育婴师,催乳,保姆'
    ELSE e.desc
  END AS many_work,
  a.grade,
  concat('\t',a.ding_userid),
  a.organization_id,
  concat('\t',a.snow_id),
  b.name,
  c.name
from
  mumway_admin a
  left join mumway_admin_department b on a.department_pid = b.id
  left join mumway_admin_department c on a.department_id = c.id
  left join mumway_store d on a.store_id = d.id
  left join mumway_masterneed e on e.id = a.work_types
where
  a.in_status != 3
order by
  a.id desc
limit
  5000;

 

上一篇:Eazfuscator.NET 2021.4 学习版 支持.Net6混淆


下一篇:MySQL:限制每个用户对记录子集的访问