1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18
| TRANSFORM ((tb2.total)+(tb1.total)) AS Expr2
SELECT magasin.identifiant
FROM objet INNER JOIN (magasin INNER JOIN m_s_o ON magasin.identifiant = m_s_o.identifiant) ON objet.numero = m_s_o.numero,
(SELECT Count(objet.numero) AS total, DatePart('ww',[objet].[date],2,1)-1 AS Expr1
FROM objet INNER JOIN (magasin INNER JOIN m_s_o ON magasin.identifiant = m_s_o.identifiant) ON objet.numero = m_s_o.numero
GROUP BY DatePart('ww',[objet].[date],2,1)
) AS tb1
INNER JOIN
(SELECT Count(objet.numero) AS total, DatePart('ww',[objet].[date],2,1)-1 AS Expr1
FROM objet INNER JOIN (magasin INNER JOIN m_s_o ON magasin.identifiant = m_s_o.identifiant) ON objet.numero = m_s_o.numero
GROUP BY DatePart('ww',[objet].[date],2,1)
) AS tb2
ON tb1.Expr1 = tb2.Expr1
GROUP BY magasin.identifiant
PIVOT DatePart('ww',[objet].[date],2,1)-1; |
Partager