Hi there, I was wondering if someone could help.
I am currently using the Northwind Database.
I have 4 queries that are identical showing (Category, Revenue) but differing by obtaining revenue by Quarter: 1995 - Q1, Q2, Q3, Q4.
Is there a way to combine this data (or build in one SQL statement) so that it displays (Category, RevQ1, RevQ2, RevQ3, RevQ4)?
Example: 'Q3Revenue1995' (sorry about my inefficient code!) :
SELECT c.categoryName as Category, Sum(od.UnitPrice*od.Quantity) AS Revenue
FROM categories AS c, [Order details] AS od, products AS p, Orders AS o
WHERE c.categoryID = p.categoryID AND p.productID = od.productID AND od.OrderID =
rderID AND (o.shippeddate between #7/1/1995# And #9/30/1995#)
GROUP BY c.categoryName
ORDER BY 2 DESC;
I'm sure there is an easy way but I am fairly new to this!
Thank you for your time,
Matt
I am currently using the Northwind Database.
I have 4 queries that are identical showing (Category, Revenue) but differing by obtaining revenue by Quarter: 1995 - Q1, Q2, Q3, Q4.
Is there a way to combine this data (or build in one SQL statement) so that it displays (Category, RevQ1, RevQ2, RevQ3, RevQ4)?
Example: 'Q3Revenue1995' (sorry about my inefficient code!) :
SELECT c.categoryName as Category, Sum(od.UnitPrice*od.Quantity) AS Revenue
FROM categories AS c, [Order details] AS od, products AS p, Orders AS o
WHERE c.categoryID = p.categoryID AND p.productID = od.productID AND od.OrderID =

GROUP BY c.categoryName
ORDER BY 2 DESC;
I'm sure there is an easy way but I am fairly new to this!
Thank you for your time,
Matt
Last edited: