tags:

views:

96

answers:

1

Hi could someone help me with this problem for my college assignment

cars

Make    MadeIn      Sales

GM      2005          100
GM      2006         1200
GM      2007          600

What I have to do is work out the greatest increase in Sales between 2005 and 2007 and display this value and the Make

I think I have the answer to the increase but cannot display the 'Make' to go along side the increase in sales (growth)

This is what I have so far

   select max(growth)
      from (
          select make, max(sales) - min(sales) as growth 
          from cars group by make) as carsales,cars;

I need the result to show

Make     Growth

GM       1100

Thanks for any help you can give

+1  A: 

The results of your query come from your first select statement

I would show you but I don't want to give to much away, you'll learn more that way.

Note that the query you have now will give you the total growth (or loss). It won't give you the growth in one year.

Justin Giboney
You have me thinking about my 1st select statement I'll try few things out - MadeIn is a date