select <想展示的东西1,想展示的东西2,...>
from <表>
group by <分组条件>
order by <排序条件>
desc/asc
-----------------------------------------------
想展示的东西:
1、直接源于某表 : t.<t表内字段名>
2、新加列: <t表内字段处理(case when 判断))> as <想展示成的字段名>
‘<想展示成的字段名> ’= <t表内字段处理case when 判断>
----------------------------------------------
t表内字段处理:
1、条件判断:
case
when t.<t表内字段名>='判断条件1' then <判断条件1结果值>
when t.<t表内字段名>='判断条件2' then <判断条件2结果值>
else <非判断条件1\2结果值>
end
as <想展示成的字段名>
*注:case when 用来select创建字段,case when 也可以与group by , order by 使用。
博客园:https://www.cnblogs.com/zxtceq/p/5580983.html
网友评论