February 10, 2010 at 9:55 am
Good Morning,
I have sales table with following fields:
Yr, Qtr, Sales
How do I compare current year quarter sales with the same quarter last year?
Original table:
YrQtrSales
20091$$
20092$$
20093$$
20094$$
20101$$
Result that I want: Ex – running report for year 2010 and qtr 1
YrQtrSalesDifference
20101$$(2009 Qtr 1 $$) – (2010 Qtr 1 $$)
February 10, 2010 at 10:24 am
Something like :
SELECT
a.Yr, a.Qtr, a.Sales, (a.Sales - b.Sales) AS [Difference]
FROM sales a
INNER JOIN sales b
ON (b.Yr + 1) = a.Yr
AND b.Qtr = a.Qtr
WHERE a.Yr = 2010
February 10, 2010 at 11:15 am
Thanks for the reply.
This query give result as:
Yr, Qtr, Sales, Difference
2009,4, $$, $$
I would like to see:
Y09Q4 Sales, Y08Q4Sales, Difference
February 10, 2010 at 2:08 pm
Golly!
SELECT
a.Sales[Y09Q4 Sales]
, b.Sales[Y08Q4 Sales]
, (a.Sales - b.Sales) AS [Difference]
FROM sales a
INNER JOIN sales b
ON (b.Yr + 1) = a.Yr
AND b.Qtr = a.Qtr
WHERE a.Yr = 2009
AND a.Qtr = 4
Viewing 4 posts - 1 through 3 (of 3 total)
You must be logged in to reply to this topic. Login to reply