好得很程序员自学网

<tfoot draggable='sEl'></tfoot>

SQL查询语句行转列横向显示实例解析

本文分享了两个有关SQL查询语句行转列横向显示的示例,供大家参考,具体内容如下

示例1:

在SQL查询语句行转列横向显示中access中没有CASE,要用IIF代替

select  iif(sex= '1 ', '男 ', '女 ')  from  tablename

select country, sum(case when type='A' then money end) as A,
sum(case when type='B' then money end) as B,
sum(case when type='C' then money end) as C
from table1
group by country

 

查看更多关于SQL查询语句行转列横向显示实例解析的详细内容...

  阅读:46次