Mysql
 sql >> Base de données >  >> RDS >> Mysql

MYSQL :JOIN double SUM

SELECT t.pid, p.name AS 'Part Name', t.InStock AS 'In Stock'
    FROM (SELECT pid, SUM(qty_left) AS InStock
              FROM not_piece
              GROUP BY pid) t
        INNER JOIN part p
            ON t.pid = p.pid