SELECT 字段1, max(IIF( 字段2='c',字段3,00)) as c,Max(IIF( 字段2='d',字段3,00)) as d,Max(IIF( 字段2='e',字段3,00)) as e,Max(IIF(字段2='f',字段3,00)) as f FROM 库 group BY 字段1
SELECT 字段1, max(IIF( 字段2='c',字段3,00)) as c,Max(IIF( 字段2='d',字段3,00)) as d,Max(IIF( 字段2='e',字段3,00)) as e,Max(IIF(字段2='f',字段3,00)) as f FROM 库 group BY 字段1
SELECT DISTINCT 字段2 FROM b1 INTO CURSOR b2
a=""
scan
a=a+',SUM(IIF(ALLTRIM(字段2)="'+ALLTRIM(字段2)+'",字段3,0)) as '+ALLTRIM(字段2)+''
ends
a='select 字段1 '+a+' from b1 group by 字段1'
&a