I created this query to get the entry of previous days, last time they entered. i dont know why but it gives me blank. can anyone please help?
select max(decode(sta,2,rd,null)) "MW_Previous",
max(decode(sta,5,rd,null)) "MV_Previous",
max(decode(sta,8,rd,null)) "P2300-3 Previous",
max(decode(sta,11,rd,null)) "P2300-4 Previous"
from history where tour=18 and shift_no=(select max(shift_no) from history where tour=18 and rev_no=1 and dt=( select dt from history where rownum=1 and 'MW_Previous'!='' or 'MV_Previous' != '' or 'P2300-3 Previous' != '' or 'P2300-4 Previous' !='' AND dt<{?SelectDate} and rownum=1 ))
select max(decode(sta,2,rd,null)) "MW_Previous",
max(decode(sta,5,rd,null)) "MV_Previous",
max(decode(sta,8,rd,null)) "P2300-3 Previous",
max(decode(sta,11,rd,null)) "P2300-4 Previous"
from history where tour=18 and shift_no=(select max(shift_no) from history where tour=18 and rev_no=1 and dt=( select dt from history where rownum=1 and 'MW_Previous'!='' or 'MV_Previous' != '' or 'P2300-3 Previous' != '' or 'P2300-4 Previous' !='' AND dt<{?SelectDate} and rownum=1 ))