This is a simplified version of my task. I have a table with in and out timestamps for users. The table columns are: id, username, timeIn, timeOut. I want to create a report that orders the results in order of the activity either in or out, and keep track if it is an in or out for the print out. My only idea so far is to create two arrays and inTimeArray and outTimeArray and then loop through them,
if (inTimeArray > outTimeArray) {
print time in: timestamp;
} else {
print timeout:;
}
output
john in:time
lucy in:time
steve in:time
lucy out:time
joel in:time
steve out:time
lucy in:time
etc.
You can use a
casestatement in your query:Then, you can just compare if timestamp = timeIn or timeOut. Additionally, you could just add another column:
Either way works, really.