Comparing values in a table
-
I don't have much knowledge in in programming and I need some help with this issue. I am using SQL 2005. I have a sales table in which I need to compare the difference in sales price of a house. Here is what the data would look like. ID SalePrice DateSale 2 90000 01/01/94 2 108500 05/12/04 2 115300 09/01/06 45 13500 03/01/54 45 98500 10/01/06 What I need, is a routine that would calulate one sale value from the preceeding for like ID. In the first case, there would be two resulting values calculated 18,500 and 6,800. These values would then be stored in a new table. I hope I have explained this well.
Dale A. Young
-
I don't have much knowledge in in programming and I need some help with this issue. I am using SQL 2005. I have a sales table in which I need to compare the difference in sales price of a house. Here is what the data would look like. ID SalePrice DateSale 2 90000 01/01/94 2 108500 05/12/04 2 115300 09/01/06 45 13500 03/01/54 45 98500 10/01/06 What I need, is a routine that would calulate one sale value from the preceeding for like ID. In the first case, there would be two resulting values calculated 18,500 and 6,800. These values would then be stored in a new table. I hope I have explained this well.
Dale A. Young
Can you kindly examplify your input and output?
-
Can you kindly examplify your input and output?
The example is simply a home sales table set up this way ID DateSale SaleAmount The table tracks all the sales that takes place in a community for the homes. A single home can be sold numerous times over its lifespan. So the challenges is to compare one sale amount to the next by date of sale. I need to calculate the difference between each sale and determine the % increase or decrease. I hope this helps.
Dale A. Young