I am getting the output but I am not sure if this is correct. I saw one or two solution using joins So I am confused that whether the query I have written is correct or not
It is a good practice to use JOIN
: Explicit vs implicit SQL joins Explicit vs implicit SQL joins.
Second you could use aliases so you do not have to type entire table name.
SELECT SUM(po.quantity) AS TotalQuantity
,SUM(po.quantity*p.price) AS TotalSaleAmount
FROM productorder po
JOIN product p
ON po.ProductId = p.ProductId
JOIN `order` o
ON o.OrderId = po.OrderId
WHERE o.OrderDate = CURDATE();
I am getting the output but I am not sure if this is correct. I saw one or two solution using joins So I am confused that whether the query I have written is correct or not
It is a good practice to use JOIN
: Explicit vs implicit SQL joins.
Second you could use aliases so you do not have to type entire table name.
SELECT SUM(po.quantity) AS TotalQuantity
,SUM(po.quantity*p.price) AS TotalSaleAmount
FROM productorder po
JOIN product p
ON po.ProductId = p.ProductId
JOIN `order` o
ON o.OrderId = po.OrderId
WHERE o.OrderDate = CURDATE();
I am getting the output but I am not sure if this is correct. I saw one or two solution using joins So I am confused that whether the query I have written is correct or not
It is a good practice to use JOIN
: Explicit vs implicit SQL joins.
Second you could use aliases so you do not have to type entire table name.
SELECT SUM(po.quantity) AS TotalQuantity
,SUM(po.quantity*p.price) AS TotalSaleAmount
FROM productorder po
JOIN product p
ON po.ProductId = p.ProductId
JOIN `order` o
ON o.OrderId = po.OrderId
WHERE o.OrderDate = CURDATE();
I am getting the output but I am not sure if this is correct. I saw one or two solution using joins So I am confused that whether the query I have written is correct or not
It is a good practice to use JOIN
: Explicit vs implicit SQL joins.
Second you could use aliases so you do not have to type entire table name.
SELECT SUM(po.quantity) AS TotalQuantity
,SUM(po.quantity*p.price) AS TotalSaleAmount
FROM productorder po
JOIN product p
ON po.ProductId = p.ProductId
JOIN `order` o
ON o.OrderId = po.OrderId
WHERE o.OrderDate = CURDATE();