473,322 Members | 1,734 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,322 software developers and data experts.

Price Vs Year - Depreciation?

36
Hi guys

You've really helped me out in the past but now I really need your help!

Basically I have a table (name=vehicletable) with the following fields/field data:

Make Model Age Price
Porsche 911 2005 40000
Porsche 911 2006 45000
Porsche 911 2004 35000
Porsche 11 2001 25000
Porsche 911 1999 20000
Porsche 911 2006 45000
Porsche 911 2006 44500
Porsche 911 2004 35250
Porsche 911 2005 40500

The table has thousands of records with varying car manufacturers, models, years and prices (not just Porsches).

I am trying to create a simple line graph to show the depreciation of a specific car (eg Porsche's) using the price by year values in my table (Price Vs Year). The line graph will therefore look something like this:

50000 |
45000 |
40000 |
35000 |
30000 |
25000 |
20000 |
15000 |
10000 |
¬¬¬¬¬¬¬¬¬¬¬¬¬¬¬¬¬¬¬¬¬¬¬¬¬¬¬¬¬¬¬¬¬¬¬¬¬¬¬¬¬¬¬¬¬¬¬¬
2002 2003 2004 2005 2006 2007

The script that I am using to render my line graph can be seen below:

------------------SCRIPT----------------------
<script type="text/javascript">
var g = new line_graph();
g.add('1', 145);
g.add('2', 0);
g.add('3', 175);
g.add('4', 130);
g.add('5', 150);
g.add('6', 175);
g.add('7', 205);
g.add('8', 125);
g.add('9', 125);
g.add('10', 135);
g.add('11', 125);

g.render("lineCanvas", "Line Graph");
</script>
---------------------------SCRIPT END--------------------------

The "1,2,3,4,5,6, etc" represents the horizontal axis and the other values represent the vertical axis. Therefore, we would need to populate the horizontal axis with "2002,2003,2004 - 2007" and use the values from the "price" field in the table to populate the vertical axis. I expect I'd need to use an "average" function but I could be wrong. I really have no idea how to approach this.

How on earth do create a sql query to achieve this?

Any ideas would be fully appreciated

I look forward to hearing from you

Best regards

Rod from the UK
Nov 13 '07 #1
1 1655
jhardman
3,406 Expert 2GB
That really is a tricky question, and every answer I can think of is a bit code-heavy. I would pull up all the data ordered by date ("age", whatever) and then calculate the average in the script. Let me know if this helps.

Jared
Nov 19 '07 #2

Sign in to post your reply or Sign up for a free account.

Similar topics

383
by: John Bailo | last post by:
The war of the OSes was won a long time ago. Unix has always been, and will continue to be, the Server OS in the form of Linux. Microsoft struggled mightily to win that battle -- creating a...
12
by: | last post by:
Does anyone know an easy way to put a current gold price on your own website? I've seen the graphic methods that Kitco.com offers, but I'd rather have it pull the value from some gold market...
2
by: nejmay | last post by:
Help Please, I am taking a beginners VB.NET class and my next assignment making a Depreciation Calculator. I am suppose to use the built in functions SLN() and SYD() to perform the calus, option...
2
by: blagdam | last post by:
I am attempting to calculate the book value of assets in a query. I calculate total depreciation of the asset using the built in Strait Line Depreciation function and then use the following...
5
by: HandersonVA | last post by:
should I set to "0" as a default value on a quantity and a price field or set to "null"? if a user enter nothing on the quantity or price field on a web browser, should I treat it as null or "0"?...
1
by: menyki | last post by:
am writing a program to determine the best price that will attract maximum demand. first i had to generate random number to enable me determine the price and quantity demanded at the particular...
1
by: 848lu | last post by:
hi, im trying to do a search on my Array, where a users searches on a HTML screen and then the PHP searches the array for the data under the roice entred by user.....text file data is under the php...
3
by: LosLobo | last post by:
Good morning all. This is my first post to the site, and what a wonderful site this is. I wish I had come across it years ago. I am working on a database that is going to track the assets for a...
0
by: DolphinDB | last post by:
Tired of spending countless mintues downsampling your data? Look no further! In this article, you’ll learn how to efficiently downsample 6.48 billion high-frequency records to 61 million...
1
isladogs
by: isladogs | last post by:
The next Access Europe meeting will be on Wednesday 6 Mar 2024 starting at 18:00 UK time (6PM UTC) and finishing at about 19:15 (7.15PM). In this month's session, we are pleased to welcome back...
0
by: Vimpel783 | last post by:
Hello! Guys, I found this code on the Internet, but I need to modify it a little. It works well, the problem is this: Data is sent from only one cell, in this case B5, but it is necessary that data...
0
by: ArrayDB | last post by:
The error message I've encountered is; ERROR:root:Error generating model response: exception: access violation writing 0x0000000000005140, which seems to be indicative of an access violation...
1
by: CloudSolutions | last post by:
Introduction: For many beginners and individual users, requiring a credit card and email registration may pose a barrier when starting to use cloud servers. However, some cloud server providers now...
1
by: Defcon1945 | last post by:
I'm trying to learn Python using Pycharm but import shutil doesn't work
1
by: Shællîpôpï 09 | last post by:
If u are using a keypad phone, how do u turn on JavaScript, to access features like WhatsApp, Facebook, Instagram....
0
by: af34tf | last post by:
Hi Guys, I have a domain whose name is BytesLimited.com, and I want to sell it. Does anyone know about platforms that allow me to list my domain in auction for free. Thank you
0
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 3 Apr 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome former...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.