If this is your first visit, be sure to
check out the FAQ by clicking the
link above. You may have to register
before you can post: click the register link above to proceed. To start viewing messages,
select the forum that you want to visit from the selection below.

Hybrid View

SQL statement into PHP coding

but then, i have a task that i must do..but i don't know how to do..
can anybody help me about it..really really need help..thank you very much!

this is the SQL statement..i don't know how to do in PHP coding, to make the result appear..

select value2,value3,
case when (tatr_status='SL' or tatr_status='C') then (count(if(date(tatr_lengkapdate)>=date(tatr_lulus_date)-interval 1 month,tatr_lengkapdate,NULL))) else (count(if(date(tatr_lengkapdate)>=curdate()-interval 1 month,tatr_lengkapdate,NULL))) end as b1,
case when (tatr_status='SL' or tatr_status='C') then (count(if(date(tatr_lengkapdate)>=date(tatr_lulus_date)-interval 2 month and date(tatr_applydate)<date(tatr_lulus_date)-interval 1 month,tatr_lengkapdate,NULL))) else (count(if(date(tatr_lengkapdate)>=curdate()-interval 2 month and date(tatr_lengkapdate)<curdate()-interval 1 month,tatr_lengkapdate,NULL))) end as b2,
case when (tatr_status='SL' or tatr_status='C') then (count(if(date(tatr_lengkapdate)>=date(tatr_lulus_date)-interval 3 month and date(tatr_applydate)<date(tatr_lulus_date)-interval 2 month,tatr_lengkapdate,NULL))) else (count(if(date(tatr_lengkapdate)>=curdate()-interval 3 month and date(tatr_lengkapdate)<curdate()-interval 2 month,tatr_lengkapdate,NULL))) end as b3,
case when (tatr_status='SL' or tatr_status='C') then (count(if(date(tatr_lengkapdate)>=date(tatr_lulus_date)-interval 4 month and date(tatr_applydate)<date(tatr_lulus_date)-interval 3 month,tatr_lengkapdate,NULL))) else (count(if(date(tatr_lengkapdate)>=curdate()-interval 4 month and date(tatr_lengkapdate)<curdate()-interval 3 month,tatr_lengkapdate,NULL))) end as b4,
case when (tatr_status='SL' or tatr_status='C') then (count(if(date(tatr_lengkapdate)<date(tatr_lulus_date)-interval 4 month,tatr_lengkapdate,NULL)))else (count(if(date(tatr_lengkapdate)<curdate()-interval 4 month,tatr_lengkapdate,NULL))) end as more,
count(*) as total
from ta_transaction,ta_fieldconvert where tatr_status=value1 and flags='status' and tatr_lengkapdate>=$P{dari} and tatr_lengkapdate<=$P{hingga} and tatr_status<>'I'
group by value2, value3 order by value3