Use this ........... :)
SELECT ECode , MIN(logdate) logdate, CASE WHEN substring(convert(varchar(20), MIN(logdate), 100), 18, 5) = 'AM' THEN 'P' ELSE 'I' END AS STATUS FROM Stu_Log
GROUP BY ECode
OUTPUT
ECode logdate STATUS
---------- ----------------------- ------
C0001 2012-12-12 07:56:05.000 P
E5890 2012-12-12 07:54:59.000 P
E6000 2012-12-12 17:32:32.000 I
Regards,
Vijay