1、排重
用到排重的sql语句
用到排重的sql语句
select distinct(region) from T_ORGAN where AAID = '0010' and group_type = 0 and connect = 1 and mid is not null and Deleted = 0
2、行转列/列转行
Pivot是行转列
Unpivot是列转行
由第二幅图转换成第一幅图,只需要用到pivot
select 星期一 , 星期二, 星期三, 星期四, 星期五, 星期六 , 星期日
from test pivot (sum(income) for week in(星期一 , 星期二, 星期三, 星期四, 星期五, 星期六 , 星期日)) as tt