select barcode,
max(iif(seqnum = 1, value, null)),
max(iif(seqnum = 2, value, null)),
max(iif(seqnum = 3, value, null)),
max(iif(seqnum = 4, value, null)),
max(iif(seqnum = 5, value, null))
from (select t.*,
(select count(*)
from t as t2
where t2.barcode = t.barcode and t2.value <= t.value
) as seqnum
from t
) t
group by barcode;
1条答案
按热度按时间sshcrbum1#
这相当棘手。我认为在ms-access中,条件聚合和相关子查询一直困扰着您。请注意,以下假设值是唯一的: