• You have some problems in your query, I'll explain in the code

    SELECT em.EmpNo as 'EmpNo',

    --You should not compare NULLs with = or <> because it will always return unknown and never true

    -- To compare NULLs use IS NULL or IS NOT NULL

    --case when tf.cDate <> null then tf.cDate else coalesce(tf.cDate, '2012-10-29') end as 'cDate',

    --In this case, you don't need the CASE, a simple COALESCE or ISNULL will work

    --I prefere ISNULL where there are only 2 possible values

    ISNULL(tf.cDate, '2012-10-29') as 'cDate',

    Min(tf.cTime) as 'timeIn', Max(tf.cTime) as 'timeOut'

    FROM tFile tf RIGHT OUTER JOIN Emp em On tf.EmpNo = em.EmpNo AND tf.cDate = '20121029'

    --You don't have anything to filter your data. In this case, the filter will be in the JOIN to avoid an INNER JOIN

    -- I turned your FULL JOIN into a RIGHT JOIN

    Group By em.EmpNo,tf.cDate

    Order By 'EmpNo'

    By the way, the design of your table is not correct, you don't need separate columns for date and time since you have information of both in the cTime column. Try to correct that.;-)

    Luis C.
    General Disclaimer:
    Are you seriously taking the advice and code from someone from the internet without testing it? Do you at least understand it? Or can it easily kill your server?

    How to post data/code on a forum to get the best help: Option 1 / Option 2