1

i have been making my internship on a project, which saving runners target access time (TAT) and i am trying to get some valuable results from these times.

Example:

How much time have runners spend between targets? (Target Time - TT)

What is the rank of runner at TAT?

Also need rank of runner at target time but now TAT is important.

I prepared some html tables for explain myself;

Here what i have. I saved this query result as view now i have been working on this view for a while (View name is "RunnerTimes").

RunnerTimes (Sqlite View)
<table width="600" height="164" border="1">
  <tr>
    <td width="48" height="38">Name</td>
    <td width="159">Target 1 AccessTime</td>
    <td width="159">Target 2 AccessTime</td>
    <td width="169">Target 3 AccessTime</td>
    <td width="172">Target 4 AccessTime</td>
    <td width="157">Target 5 AccessTime</td>
  </tr>
  <tr>
    <td height="37">John</td>
    <td>13:06:00</td>
    <td>13:25:00</td>
    <td>13:32:00</td>
    <td>13:42:00</td>
    <td>13:53:00</td>
  </tr>
  <tr>
    <td height="38">Alice </td>
    <td>13:07:00</td>
    <td>13:22:00</td>
    <td>13:34:00</td>
    <td>13:44:00</td>
    <td>13:56:00</td>
  </tr>
  <tr>
    <td height="39">Mark</td>
    <td>13:05:00</td>
    <td>13:27:00</td>
    <td>13:34:00</td>
    <td>13:41:00</td>
    <td>13:54:00</td>
  </tr>
</table>

But my supervisor needs something more complicated table.

Supervisor needs table like that
<table width="600" height="342" border="1">
  <tr>
    <td width="48">Name</td>
    <td width="159">Target 1 AccessTime</td>
    <td width="159">Target 2 AccessTime</td>
    <td width="169">Target 3 AccessTime</td>
    <td width="172">Target 4 AccessTime</td>
    <td width="157">Target 5 AccessTime</td>
  </tr>
  <tr bgcolor="#FFCC66">
    <td>John</td>
    <td>13:06:00 (2)</td>
    <td>13:25:00 (2)</td>
    <td>13:32:00 (1)</td>
    <td>13:42:00 (2)</td>
    <td>13:53:00 (1)</td>
  </tr>
  <tr>
    <td height="51">&nbsp;</td>
    <td>&nbsp;</td>
    <td> <p>time = 00:19:00 <br>
      time = target2 - target1</p></td>
    <td>00:07:00</td>
    <td>00:06:00</td>
    <td>00:11:00</td>
  </tr>
  <tr bgcolor="#FFCC66">
    <td>Alice </td>
    <td>13:07:00 (3)</td>
    <td>13:22:00 (1)</td>
    <td>13:34:00 (2)</td>
    <td>13:44:00 (3)</td>
    <td>13:56:00 (3)</td>
  </tr>
  <tr>
    <td>&nbsp;</td>
    <td>&nbsp;</td>
    <td> 00:15:00</td>
    <td>00:12:00</td>
    <td>00:10:00</td>
    <td>00:12:00</td>
  </tr>
   <tr bgcolor="#FFCC66">
    <td>Mark</td>
    <td>13:05:00 (1)</td>
    <td>13:27:00 (3)</td>
    <td>13:34:00 (3)</td>
    <td>13:41:00 (1)</td>
    <td>13:54:00 (2)</td>
  </tr>
  <tr>
    <td>&nbsp;</td>
    <td>&nbsp;</td>
    <td> 00:22:00</td>
    <td>00:07:00</td>
    <td>00:07:00</td>
    <td>00:13:00</td>
  </tr>
</table>

How do I achieve this ranks "(2)" or "(1)" like at this table.

I tried to do it by myself in C# but its ultraslow, calculating Target Times, querying runner ranks and after adding these to table is very slow.

Can some one help me? Sorry for bad english cheers :)


Edit

RunnerTimes - below sql gives me table of access times - IF there is no access writing 'mp' to cell

"SELECT t.braceletID As 'Bracelet',(t.Name|| ' ' || t.Surname) As 'Runner',
IFNULL( MAX(CASE WHEN r.ControlID = 24 THEN time(julianday(strftime('%H:%M:%S',r.accesstime))-.5)END),'mp') AS '1',

IFNULL( MAX(CASE WHEN r.ControlID = 26 THEN time(julianday(strftime('%H:%M:%S',r.accesstime))-.5)END),'mp') AS '2',

IFNULL( MAX(CASE WHEN r.ControlID = 28 THEN time(julianday(strftime('%H:%M:%S',r.accesstime))-.5)END),'mp') AS '3',

IFNULL( MAX(CASE WHEN r.ControlID = 23 THEN time(julianday(strftime('%H:%M:%S',r.accesstime))-.5)END),'mp') AS '4',

IFNULL( MAX(CASE WHEN r.ControlID = 25 THEN time(julianday(strftime('%H:%M:%S',r.accesstime))-.5)END),'mp') AS '5'

FROM Runner t Left Outer Join RunnerAccess r On  t.braceletid = r.RunnerID 

Where t.categoryid=1  GROUP BY  t.braceletid"

Runners participate in category and targets are different for categories At this query targets are "24 - 26 - 28 - 23 - 25". I changed column names and setted them to "1 - 2 - 3 - 4 - 5" then created RunnerTimes view in SQLite.

2

0

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Browse other questions tagged or ask your own question.