|
吼吼,你又来这里发帖,我的03版只能接受12个货架的:
SELECT 编号, 名称, MAX(区域) AS 区域1, IIF(MAX(区域)=MIN(区域),'',MIN(区域)) AS 区域2
FROM (select * from [01$B3:D27] UNION select * from [01$E3:G27] UNION select * from [01$H3:J27] UNION select * from [01$K3:M27] UNION select * from [02$B3:D27] UNION select * from [02$E3:G27] UNION select * from [02$H3:J27] UNION select * from [02$K3:M27] UNION select * from [03$B3:D27] UNION select * from [03$E3:G27] UNION select * from [03$H3:J27] UNION select * from [03$K3:M27] UNION select * from [04$B3:D27] UNION select * from [04$E3:G27] UNION select * from [04$H3:J27] UNION select * from [04$K3:M27] UNION select * from [05$B3:D27] UNION select * from [05$E3:G27] UNION select * from [05$H3:J27] UNION select * from [05$K3:M27] UNION select * from [06$B3:D27] UNION select * from [06$E3:G27] UNION select * from [06$H3:J27] UNION select * from [06$K3:M27] UNION select * from [07$B3:D27] UNION select * from [07$E3:G27] UNION select * from [07$H3:J27] UNION select * from [07$K3:M27] UNION select * from [08$B3:D27] UNION select * from [08$E3:G27] UNION select * from [08$H3:J27] UNION select * from [08$K3:M27] UNION select * from [09$B3:D27] UNION select * from [09$E3:G27] UNION select * from [09$H3:J27] UNION select * from [09$K3:M27] UNION select * from [10$B3:D27] UNION select * from [10$E3:G27] UNION select * from [10$H3:J27] UNION select * from [10$K3:M27] UNION select * from [11$B3:D27] UNION select * from [11$E3:G27] UNION select * from [11$H3:J27] UNION select * from [11$K3:M27] UNION select * from [12$B3:D27] UNION select * from [12$E3:G27] UNION select * from [12$H3:J27] UNION select * from [12$K3:M27])
WHERE (编号 Is Not Null)
GROUP BY 编号, 名称
ORDER BY 编号
那位用07版或10版的,测试以下代码:
SELECT 编号, 名称, MAX(区域) AS 区域1, IIF(MAX(区域)=MIN(区域),'',MIN(区域)) AS 区域2
FROM (select * from [01$B3:D27] UNION select * from [01$E3:G27] UNION select * from [01$H3:J27] UNION select * from [01$K3:M27] UNION select * from [02$B3:D27] UNION select * from [02$E3:G27] UNION select * from [02$H3:J27] UNION select * from [02$K3:M27] UNION select * from [03$B3:D27] UNION select * from [03$E3:G27] UNION select * from [03$H3:J27] UNION select * from [03$K3:M27] UNION select * from [04$B3:D27] UNION select * from [04$E3:G27] UNION select * from [04$H3:J27] UNION select * from [04$K3:M27] UNION select * from [05$B3:D27] UNION select * from [05$E3:G27] UNION select * from [05$H3:J27] UNION select * from [05$K3:M27] UNION select * from [06$B3:D27] UNION select * from [06$E3:G27] UNION select * from [06$H3:J27] UNION select * from [06$K3:M27] UNION select * from [07$B3:D27] UNION select * from [07$E3:G27] UNION select * from [07$H3:J27] UNION select * from [07$K3:M27] UNION select * from [08$B3:D27] UNION select * from [08$E3:G27] UNION select * from [08$H3:J27] UNION select * from [08$K3:M27] UNION select * from [09$B3:D27] UNION select * from [09$E3:G27] UNION select * from [09$H3:J27] UNION select * from [09$K3:M27] UNION select * from [10$B3:D27] UNION select * from [10$E3:G27] UNION select * from [10$H3:J27] UNION select * from [10$K3:M27] UNION select * from [11$B3:D27] UNION select * from [11$E3:G27] UNION select * from [11$H3:J27] UNION select * from [11$K3:M27] UNION select * from [12$B3:D27] UNION select * from [12$E3:G27] UNION select * from [12$H3:J27] UNION select * from [12$K3:M27] UNION select * from [13$B3:D27] UNION select * from [13$E3:G27] UNION select * from [13$H3:J27] UNION select * from [13$K3:M27] UNION select * from [16$B3:D27] UNION select * from [16$E3:G27] UNION select * from [16$H3:J27] UNION select * from [16$K3:M27] UNION select * from [17$B3:D27] UNION select * from [17$E3:G27] UNION select * from [17$H3:J27] UNION select * from [17$K3:M27] UNION select * from [18$B3:D27] UNION select * from [18$E3:G27] UNION select * from [18$H3:J27] UNION select * from [18$K3:M27] UNION select * from [19$B3:D27] UNION select * from [19$E3:G27] UNION select * from [19$H3:J27] UNION select * from [19$K3:M27] UNION select * from [24$B3:D27] UNION select * from [24$E3:G27] UNION select * from [24$H3:J27] UNION select * from [24$K3:M27])
WHERE (编号 Is Not Null)
GROUP BY 编号, 名称
ORDER BY 编号 |
|