Skip to Content

Missing Logic for Last Review date

hi experts

  from bellow query i'm not getting emp last hike date

SELECT T0.[empID], T0.[firstName],T0.[salary] ,T1.[remarks],

(SELECT max  (T1.[Date] ) FROM OHEM T0 full JOIN HEM3 T1 ON T0.empID = T1.empID )

  FROM OHEM T0 full JOIN HEM3 T1 ON T0.empID = T1.empID WHERE T0.[status] is null  AND  T0.[termReason] IS NULL

please help me

Thanks & Regards

  Andakondaramudu

Add comment
10|10000 characters needed characters exceeded

  • Get RSS Feed

1 Answer

  • Best Answer
    Sep 17, 2014 at 11:57 AM

    Hi,

    Try this:

    SELECT T0.[empID], T0.[firstName],T0.[salary] ,T1.[remarks],

    (SELECT max  (T1.[Date] ) FROM OHEM T0 left  JOIN HEM3 T1 ON T0.empID = T1.empID )

      FROM OHEM T0 left JOIN HEM3 T1 ON T0.empID = T1.empID WHERE T0.[status] is null  AND  T0.[termReason] IS NULL

    Thanks & Regards,

    Nagarajan

    Add comment
    10|10000 characters needed characters exceeded

    • hi silambu

      thanks for u r replay ,i did miner changer then it will work fine

      SELECT T0.[empID], T0.[firstName],T0.[salary],Max(convert(nvarchar(max),T1.[remarks])) Remarks,MAX(T1.[Date]) HighDate

          FROM OHEM T0 left outer  JOIN HEM3 T1 ON T0.empID = T1.empID

          WHERE T0.[termDate] IS NULL

          group by T0.[empID], T0.[firstName],T0.[salary]

      Thanks &regards

         Andakondaramudu