Subqueries inside SELECT statements:
- /* Using subquery in SELECT statement.
- This example uses the IceCreamStore database.
- */
- SELECT (SELECT SUM(F.flavorID)) AS 'Varieties Available', B.Name AS 'Brand Name'
- FROM Flavors AS F
- INNER JOIN xBrandFlavorDistributors AS XFD
- ON Xfd.flavorID = F.flavorID
- INNER JOIN Brands AS B
- ON XFD.brandID = B.brandID
- GROUP BY B.Name;
Subqueries inside the FROM clause:
- /* Using subquery in FROM clause.
- This example uses the IceCreamStore database.
- */
- SELECT F.Name
- FROM (
- SELECT * FROM Flavors
- ) AS F
No comments:
Post a Comment