It sounds to me like you might be trying to find the standard deviation or the variance, which are functions you can use right in your query.

On Nov 2, 2007, at 7:37 AM, Octavian Rasnita wrote:

Hi,

I have a table with the following columns:

symbol
date
value

I want to select all the symbols (grouping by symbols) between 2 specified dates, and calculate the percent of change for each symbol.

The percent of change is (the value from the last date of the symbol - the value from the first date) / the value from the first date.

For example I have:

SMB1, 2007-01-01, 1000
SMB1, 2007-03-15, 2100
SMB1, 2007-10-10, 1300
... (other symbols)

And the result of the select should be:
SMB1, 0.3

Is it possible to do this with an MySQL query?

Thank you.

Octavian


--
MySQL General Mailing List
For list archives: http://lists.mysql.com/mysql
To unsubscribe: http://lists.mysql.com/mysql? [EMAIL PROTECTED]



--
MySQL General Mailing List
For list archives: http://lists.mysql.com/mysql
To unsubscribe:    http://lists.mysql.com/[EMAIL PROTECTED]

Reply via email to