Sub query problem

  • Thread starter Thread starter scubadiver
  • Start date Start date
S

scubadiver

Eg data

Live month Current month next month Percentage
Aug 06 5 1 -80%
Sep 06 1

Live month Current month next month Percentage
Aug 06 2
Sep 06 8 2 -75%

But I would prefer the first example to be

Live month Current month next month Percentage
Aug 06 5
Sep 06 1 5 80%


I realise the WHERE statement is wrong but not sure how to modify it.
Subqueries aren't aren't a forte of mine at the moment.

thanks



SELECT E164src.LiveMonth, E164src.Total AS [Current month],

(SELECT
total from E164src AS temp
WHERE
(temp.total<E164src.total)) AS [next month],

(([next month]-[Current month])/[Current month]) AS Percentage

FROM E164src;
 
I will add I also have a field for [MonthID] which is a numerical indicator
for each month
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Similar Threads

subquery prob (repost) 4
Qry Running Average 5
Calculate percentage 8
Problem with Update Query 5
Fiscal year 2
Amazon are rubbish 14
Cross Tab Query & Dates 5
Pivot Table Question 3

Back
Top