J'ai mis un Select dans un Join pour règler un problème de performance mais le stats1.cnt est toujours 1. Pourquoi ?

Code : Sélectionner tout - Visualiser dans une fenêtre à part
1
2
3
4
5
6
7
8
SELECT stats1.cnt1 
  FROM staging.memberships_autoship_box b 
  JOIN staging.memberships_autoship a 
    ON a.id = b.autoship_box_id 
  JOIN (SELECT COUNT(bn.autoship_box_id) cnt1,bn.autoship_box_id 
          FROM staging.memberships_autoship_box bn 
         GROUP BY bn.autoship_box_id ) stats1 
    ON (stats1.autoship_box_id = a.id)