James Dean
James Dean

Reputation: 23

Combine two rows into one?

May I know the code to combine this two database item? I mean the TimeOUT from the second line would be in the first TimeOUT so it will be not null when I cast this out to the listview.

Please see image here:

image

I am using C#.

Upvotes: 0

Views: 128

Answers (1)

GMB
GMB

Reputation: 222582

For this dataset, aggregation would do:

select
    empID,
    firstName,
    lastName,
    date,
    min(timeIn) timeIn,
    max(timeOut) timeOut
from mytable
group by
    empID,
    firstName,
    lastName,
    date

Upvotes: 1

Related Questions