The below query am running ,at the bolded column am the error (The multi-part identifier alias.field could not be bound)
declare @date datetime select @date= case when i.ElC_TransDate is null then ac.Opblac_date else i.ElC_TransDate end from (select top 1. b.ElC_TransDate from tbl_ElectronicCards b inner join tbl_AccountSummary ac on b.DlP_DealerID=ac.dealer_id inner join tbl_TransactionType c on b.elc_transtype=c.ElC_ElectronicCardID inner join tbl_EFT eft on b.DlP_DealerID=eft.DlP_DealerId inner join tbl_EFTNotifyCredit EFTNC on eft.EnC_NotifyId = EFTNC.EnC_NotifyId where b.DlP_DealerID=63 and b.ElC_TransDate < '11/01/2014' or ac.openingbalance <='11/01/2014' order by b.ElC_TransDate desc)i order by ElC_TransDate desc print @date

Can you please guide me where am going wrong
Thanks in advance

Go to the complete details ...