computation

1. Junior Member
Join Date
Dec 1969
Posts
1

## computation

Gud day!<BR>I would like to learn how to get the difference for every login and logout of each user ID and be able to add the total time of log of every user for every same transaction (internet or encoding)that has been done and how to compute the equivalent payment if internet is charged at 20php/hour or 5php/15 minutes or below and encoding is charged at 10php/hr also divided into quarter.<BR><BR>Transaction Table<BR>User_ID Date Transaction Login Logout<BR>00S04093 9/6/2004 Encoding 9:10:00 AM 9:10:00 AM<BR>00TCA268 9/7/2004 Internet 8:59:00 AM 9:55:00 AM<BR>01030324 9/7/2004 Encoding 9:04:00 AM 9:33:00 AM<BR>01000523 9/7/2004 Internet 9:11:00 AM 9:46:00 AM<BR>01030162 9/7/2004 Internet 9:16:00 AM 9:25:00 AM<BR>00s04093 10/10/2004 Internet 10:14:00 AM 10:28:00 AM<BR>00TCA268 10/10/2004 Encoding 10:16:00 AM 11:00:00 AM<BR>01030324 10/11/2004 Encoding 1:11:00 PM 3:01:00 PM<BR>01030162 10/11/2004 Encoding 1:13:00 PM <BR>01030324 10/11/2004 Encoding 1:46:00 PM <BR>

2. Senior Member
Join Date
Dec 1969
Posts
16,931

## RE: computation

Okay. So what have you tried?<BR><BR>You want a SQL statement that gets the summation of the time difference (hmm, not sure you can do this in one query, but we&#039;ll try) per user per transaction type.<BR><BR>You then want to analyse that data, breaking the time into hours, then quarter hours (or part thereof) per user per transaction type.<BR><BR>Then you want to work out, for each transaction type for each user, the cost. Once you&#039;ve got that, you need to group the data per user to work out their charge.<BR><BR>So, what&#039;ve you tried?<BR><BR>Craig.

3. Senior Member
Join Date
Dec 1969
Posts
96,118

...Reaper&#039;s questions, also mention which database you are using.<BR><BR>Are you supposed to do this 100% in SQL? Or in a combo of SQL and ASP?<BR><BR>And what are you supposed to do about those last two records, where you have Login times but no Logout yet?<BR><BR>

4. Senior Member
Join Date
Dec 1969
Posts
10,852

## Another issue...

Is what do you want to do with time periods that don&#039;t fit neatly into fifeteen minute segments? Round up, or down to the nearest fifteen minute interval? Or do something else entirely?

5. Senior Member
Join Date
Dec 1969
Posts
96,118

## I think she answered that one

She wrote "...or 5php/15 minutes or below ..."<BR><BR>In other words, any leftover fraction of 15 minutes still gets charged the 15 minutes rate.<BR><BR>16 minutes gets charged as 30 minutes.<BR><BR>

6. Senior Member
Join Date
Dec 1969
Posts
10,852

## Gotcha.

I missed that the first time around. Not that I guess it matters at this point, since it doesn&#039;t look like she&#039;s coming back to answer any of the other questions anyway. Oh well.

#### Posting Permissions

• You may not post new threads
• You may not post replies
• You may not post attachments
• You may not edit your posts
•