方法一:

SELECT

    p.prod_name,

    st.quant_sold

FROM

    Products AS p

    LEFT JOIN (

        SELECT

            prod_id,

            SUM(quantity) AS quant_sold

        FROM

            OrderItems

        GROUP BY

            prod_Id

    ) AS st

    ON st.prod_id = p.prod_id

方法二:

SELECT

    p.prod_name,

    st.quant_sold

FROM

    Products AS p,

    (

        SELECT

            prod_id,

            SUM(quantity) AS quant_sold

        FROM

            OrderItems

        GROUP BY

            prod_Id

    ) AS st

WHERE

    st.prod_id = p.prod_id