I have one table TempImport and the selected query result is as display is image. But I want to get result in order by code as order present in tempImport table using SQL Server
the select query is:
SELECT DISTINCT Code,
    (dd.dd_receipt_no)
FROM   TempImport tm WITH(NOLOCK)
    INNER JOIN depositor_mast dm WITH(NOLOCK)
            ON  tm.Code = dm.dm_code
    INNER JOIN deposit_detl dd WITH(NOLOCK)
            ON  dm.dm_srno = dd.dd_dm_srno
WHERE  dd.dd_dt_code IN ('PDFP', 'PDFD', 'PDFE')
    AND tm.Remark = 'OK'
    AND dm.dm_dep_ind = 'PDEP'
    AND dd.dd_delind = 'L'
    AND dd.dd_exit_date = 0
    AND (dd.Certificate_No = '' OR dd.Certificate_No IS NULL)
Image shows TempImport , Selected Result and Required Result
 
    