Hi Every one
I have three tables Location master, Transaction master and Transaction detail find the attached excel sheet for sample data. Plz help me for design a set expression for following (SQL)condition.
select * from
(select loccd,
round((sum(case when TdFrRmLoc=loccd and TdFrRmDc='c' and tdt between '01/06/05' and '30/08/05' then TdRmWt else 0 end)+
sum(case when TdToRmLoc=loccd and TdToRmDc='C' and tdt between '01/06/05' and '30/08/05' then TdRmWt else 0 end)),3) as Issue
from txn
join txnd on ttc=tdtc and tyy=tdyy and tchr=tdchr and tno=tdno
join loc on (LocCd=TdFrRmLoc or LocCd=TdtoRmLoc) and LocTyp='S'
group by loccd)
Thanks
Vikas