码迷,mamicode.com
首页 > 其他好文 > 详细

根据用户的积分、获取用户的等级,如果用户没有积分,则显示没有等级

时间:2018-06-22 20:59:05      阅读:204      评论:0      收藏:0      [点我收藏+]

标签:order   outer   获取   The   when   用户表   AC   显示   username   

--t_user 用户表 t_account 积分表 t_integral 等级表
--根据用户的积分、获取用户的等级,如果用户没有积分,则显示没有等级
select t.id,t.username,ta.userId,
(select
(case
when (ta.pointValue >integral_start && ta.pointValue< integral_end) then rank_name
else null
end
) gradea
from t_integral order by gradea desc limit 0,1
) grade
from t_user t left outer join t_account ta on t.id=ta.userId where t.id=‘用户id‘;

根据用户的积分、获取用户的等级,如果用户没有积分,则显示没有等级

标签:order   outer   获取   The   when   用户表   AC   显示   username   

原文地址:https://www.cnblogs.com/NiceTime/p/9215394.html

(0)
(0)
   
举报
评论 一句话评论(0
登录后才能评论!
© 2014 mamicode.com 版权所有  联系我们:gaon5@hotmail.com
迷上了代码!