views:

39

answers:

2

I have a program (flex) that queries a database and gets back a dataset (value, timestamp). In the program I then put each value in the set through an algorithm to get a new value resulting in all the values being transformed. Instead of having to do this transformation of data in my program I would like mysql to do it and send the results back. Essentially, I would like to do a SELECT statement that returns a modified dataset.

A: 

You might be able to do it as part of your data retrieval statement, i.e., an SQL SELECT. Whether this is sensible or not depends on the complexity of what you want to do. Dense logic in SQL functions can be pretty much 'write-once never comprehend again'.

I'd review the available MySQL functions to see whether you can achieve what you're after easily. If not, I'd advise you to keep that stuff in the client.

martin clayton
+1  A: 

Assuming the computation can only be done in a stored procedure or function, yes - as long as you are using MySQL 5.0+. I recommend reading this article on MySQL stored procedures & functions.

OMG Ponies