select a.billno,a.billcode,a.billno,a.dates,a.ontime,c.OrgName,d.CardCode,d.Beactive,d.fakrq,d.sxrq,b.Balance as handSelAmt,d.Balance
from RetBillMt a(nolock)
join TrCouponDt b(nolock) on a.entid=b.entid and a.billno=b.billno
join OrgDoc c(nolock) on c.EntId = a.EntId and c.OrgId = a.OrgId
join CardDoc d(nolock) on d.EntId = b.EntId and d.CardId = b.CardId
join ContactDoc e(nolock) on e.EntId = a.EntId and e.ContactId = a.ContactId
where a.billno = :billno and a.entid = :_entid
order by a.billcode
If opportunity doesn’t knock, build a door