Hi all
I have a php script that calls a sql. I was just wondering how i would do it in scriptcase.
Below is the sql.
SET @row_num := 0;
select (@row_num := @row_num + 1) AS row_num,
ipdate,
product,
market_value_1,
(select market_value_1
from (select t3.ipdate, t3.market_value_1, t3.product
from report_combined t3
where t3.product = 'ASISA MA High Equity Composite'
and t3.ipdate between '2013-11-01' and '2013-12-01'
group by t3.ipdate, t3.market_value_1, t3.product) t2
where t2.ipdate < t1.ipdate
order by t2.ipdate desc
limit 1) prev_day,
if(@row_num = 1, 100, (select ((market_value_1/100) / ((prev_day/100) )))*100) calculated
from (select t1.ipdate,
t1.product,
t1.market_value_1
from report_combined t1
where product = 'ASISA MA High Equity Composite'
and ipdate between '2013-11-01' and '2013-12-01'
group by ipdate, product, market_value_1) t1
;