I have a query in which, I want to apply CASE condition. This is my query:
Select
a.mkey, a.party_name, a.doc_no Inward_No,
c.type_desc Doc_Type, a.ref_no,
convert(varchar(25),a.ref_date,103) Ref_date,
a.Inward_amt, b.first_name + ' ' + b.last_name ToUser --- here
from
inward_doc_tracking_hdr a
inner join
user_mst b on a.To_User = b.mkey
inner join
type_mst_a c on a.doc_type = c.master_mkey
and a.mkey =227423
What I want is: if I get ToUser as NULL then I want to take Last_To_User in place of that.
How to do this in SQL Server?
Aucun commentaire:
Enregistrer un commentaire