Hi,
Thank a lot for your advise. I really want what you mentioned "
showing that Latness should come from the MIN(time_in) record and Overtime should come from the MAX(time_out) record. If this is correct then we need to do this with two queries and a UNION."
Yet, the sql I written only give me the last lateness and overtime records, how can i use two sql with union to do what I want. Please advise me with example
Thank a lot.
>> emp_id C(4)
>> emp_name C(30)
>> date D
>> in_time T
>> out_time T
>> lateness C(4)
>> overtime C(4)
>
>Hi Virusim,
>This will get you close to the desired output example you gave us in your first post...
>
>SELECT emp_id, DTOC(time_in) as TheDate, MIN(TTOC(time_in,2)), ;
> MAX(TTOC(time_out,2)), latness, overtime ;
> FROM TableName GROUP BY empid
>
>
>One problem I see is that in the desired output you posted, you seem to be showing that Latness should come from the MIN(time_in) record and Overtime should come from the MAX(time_out) record. If this is correct then we need to do this with two queries and a UNION. The SELECT I give you above is going to carry the Latness and Overtime fields from the last record found in the Group By.
Best Regards
Virusim