I have a query which gives me 5 records in the sql, but I want to show one record which is latest one.
Below is my query
Select a.mkey, c.type_desc DOC_TYPE, a.doc_no INWARD_NO,
convert(varchar, a.doc_date,103)date,
a.to_user, a.No_of_pages, Ref_No, d.type_desc DEPT_RECEIVED, b.first_name + ' ' +
b.last_name EMP_RECEIVED, b.first_name + ' ' + b.last_name NAME,
b.email
from inward_doc_tracking_hdr a , user_mst b ,type_mst_a c,
type_mst_a d
where a.to_user = b.mkey and a.doc_type = c.master_mkey
and a.dept_received = d.Master_mkey and a.to_user = '1260'
Below is the result
I am using sql-server-2005
I tried with TOP1 but it is not giving me the latest record
Aucun commentaire:
Enregistrer un commentaire