我有一个表aa ,aa表里有三个字段,姓名,入库日期,出库日期
我想做个报表显示入库姓名,出库姓名
这个报表怎么写SQL语句啊,请各位前辈指点我
------解决方案--------------------
select max(case when 入库日期 is not null then 姓名 end) as 入库姓名,
max(case when 出库日期 is not null then 姓名 end) as 出库姓名
from aa
group by 姓名;
select max(case when 入库日期 is not null then 姓名 end) as 入库姓名,
max(case when 出库日期 is not null then 姓名 end) as 出库姓名
from aa
group by 姓名;