Is it possible that a MySQL function/stored procedure returns a query result?
Because I want to have this on PHP:
SET @csum:=0;
SELECT
datvalor AS 'Date',
company AS 'Company',
(@csum:=@csum + amount) AS 'Sum'
FROM tbl_test
ORDER BY datvalor
but PHP can´t run multiple lines, right?
I’ve searched but everyone says that a procedure can’t return a table. How will you solve this?
I don’t want to put the Sum calculation on php, the goal here is too generate everything on MySQL
Tks
After more research, I’ve found that the way is use mysqli (MySQL Improved) instead of mysql, just don’t know the little details (yet)