mardi 9 août 2016

Description of NStatus_flag not coming proper from query

I have created a query in which I want the description for NStatus_flag which comes from

select * from type_mst_a where type_code = 'S2'

have a look

img

but when I run in the beloq query, I dont proper result.

select a.mkey, b.mkey, b.CUser_Id, c.first_name + ' ' + c.last_name CurrentUser,
    d.Type_desc Department, e.Type_desc
     from inward_doc_tracking_hdr a
        inner join inward_doc_tracking_trl b
            on a.mkey = b.ref_mkey
        inner join user_mst c
            on c.mkey = b.CUser_Id  
        inner join type_mst_a d
            on d.master_mkey = b.CDept_Id   
        inner join type_mst_a e
            on e.master_mkey = b.NStatus_flag -- and e.Type_code = 'S2' 
    where a.mkey = 227423

Let me know where I am wrong

Aucun commentaire:

Enregistrer un commentaire