我正在使用ms access 2016。我的查询结果如下:
我需要如下结果:
我的问题是:
SELECT IIf([Posisi]="Supervisor",[Nm_Karyawan]) AS Supervisor, IIf([Divisi]="Dept001" And [SubDivisi]="Operator",[Nm_Karyawan]) AS Printing, IIf([Divisi]="Dept001" And [SubDivisi]="Tinta",[Nm_Karyawan]) AS Tinta, IIf([Divisi]="Dept001" And [SubDivisi]="Cylinder",[Nm_Karyawan]) AS Cylinder, IIf([Divisi]="Dept003" And [SubDivisi]="Operator",[Nm_Karyawan]) AS Dry, IIf([Divisi]="Dept002" And [SubDivisi]="Operator",[Nm_Karyawan]) AS Extrusion, IIf([Divisi]="Dept004" And [SubDivisi]="Operator",[Nm_Karyawan]) AS Slitting, IIf([Divisi]="Dept005" And [SubDivisi]="Operator",[Nm_Karyawan]) AS Rewind
FROM T_User1
WHERE (((T_User1.Group)="001"))
GROUP BY IIf([Posisi]="Supervisor",[Nm_Karyawan]), IIf([Divisi]="Dept001" And [SubDivisi]="Operator",[Nm_Karyawan]), IIf([Divisi]="Dept001" And [SubDivisi]="Tinta",[Nm_Karyawan]), IIf([Divisi]="Dept001" And [SubDivisi]="Cylinder",[Nm_Karyawan]), IIf([Divisi]="Dept003" And [SubDivisi]="Operator",[Nm_Karyawan]), IIf([Divisi]="Dept002" And [SubDivisi]="Operator",[Nm_Karyawan]), IIf([Divisi]="Dept004" And [SubDivisi]="Operator",[Nm_Karyawan]), IIf([Divisi]="Dept005" And [SubDivisi]="Operator",[Nm_Karyawan]);
这是我的table:
如有需要,请帮助我查询结果。谢谢您。
你好,费尔南多
1条答案
按热度按时间nzk0hqpo1#
你可以使用(假)聚合函数
对于空值,请尝试使用nz()