Question: I am trying to make a simple web based clock app using pure java-script. I think the general code is right, but I'm not sure how to automatically call the function at a set interval of time. I thought the window.onload, followed by the setInterval method would do this. But it's not automatically updating every half second as I expected. What am I doing wrong?

```
<!doctype html>

<html>

    <head>
        <title>Real Time Clock</title>
        <script>

            var time, h, m, s, track;
            track = 0;
            window.onload = function() { setInterval( timeNow(), 100); }

            function timeNow() {

              time = new Date();
              track += 1;
              h = time.getHours();
              m = time.getMinutes();
              s = time.getSeconds();
              if ( s < 10 ) { s = "0" + s; } /* we add a 0 in front of s, when it is lower than 10, because that's what most clocks display, this is for the human user rather than for any need by the computer */
              document.getElementById("time").innerHTML = h + ':' + m + ':' + s;
              document.getElementById("track").innerHTML = track;

            }

        </script>
    </head>

    <body>

        <span id="time">~Waiting for time update.</span><br>
        <span id="track"></span>

    </body>

</html>

```

Answer: 
You can do a self join:

```
DECLARE @T TABLE (Colour VARCHAR(20))
INSERT @T VALUES ('Red'), ('Blue'), ('White');

SELECT  T1.Colour, 
        t2.Colour, 
        T1.Colour + ' - ' + T2.Colour AS InOneColumn
FROM    @T AS T1
        INNER JOIN @T AS T2
            ON T2.Colour > T1.Colour;

```

You just need a condition to ensure that you don't get mirrored combinations, i.e. `Blue - White` and `White - Blue`. Using the greater than operator in the join will ensure this.
```
select concat(t2.colour,'-',t1.colour) from table1 t1,table1 t2 where t1.colour>t2.colour order by t2.colour,t1.colour;

```

Replace table name and try this.