tab
col1 col2 name
100 0 A
200 1 A
150 0 B
160 1 B
col1都是数字,col2就是0和1之前重复
我想获得这样的数据
name col3 col4
A 100 200
B 150 160
这种。怎么写查询语句?
------解决方案--------------------
- SQL code
select name , max(case col2 when 0 then col1 else 0 end) col3, max(case col2 when 1 then col2 else 0 end) col3from tabgroup by name
------解决方案--------------------
可以用交叉报表自动生成