pasture.sql 301 B

123456789101112131415
  1. select
  2. case
  3. when name is null then
  4. case when pp.center is null then '集团'
  5. else if(pp.region is null,pp.center,pp.region)
  6. end
  7. else name
  8. end pastureName
  9. from
  10. pasture pp
  11. where id <>18
  12. group by
  13. pp.center,
  14. pp.region,
  15. name with rollup