引用來源
參考2
--
--範例A
SELECT
Product_ID,
Product_Name,
(SELECT count(*) FROM Order_List) AS NUMBER_OF_ORDER
FROM Product_List
ORDER BY Product_Price DESC
--範例B
SELECT A.*
FROM
(
SELECT Product_ID, Product_Price FROM Product_List
) AS A
WHERE
A.Product_Price > 500
ORDER BY A.Product_Price DESC
--範例C
SELECT
Product_ID,
Product_Name
FROM Product_List
WHERE Product_ID IN
(
SELECT
Product_ID
FROM
Order_List
GROUP BY
Product_ID
HAVING count(*) >=2
)
沒有留言:
張貼留言