select c.customer_id,c.first_name,c.points, 'Bronze' as type
from customers c
where c.points < 2000
union
select c.customer_id,c.first_name,c.points, 'Silver' as type
from customers c
where c.points between 2000 and 3000
union
select c.customer_id,c.first_name,c.points, 'Gold' as type
from customers c
where c.points > 3000
order by first_name;
-- union:用来合并多个表的查询结果,每个表的列数量需要保持一致否则会报错。
感谢各位读者查阅,欢迎各位👍点赞?评论?收藏+关注!