How to create 2d array from SQLite database in Ionic 2
<p>I would like to create a 2d array from joined tables using SQLIte in Ionic 2/Typescript. This is an tennis score tracker and I have 2 tables: matches and match_stats. For each set of the match new row in match_stats tables is created. I want to display the score by JOIN</p>

<pre><code>let query = "SELECT id, points_player1, points_player2, ms.games_player1 AS games_player1, ms.games_player2 AS games_player2 "+
                "FROM matches AS m "+
                "LEFT JOIN match_stats AS ms ON m.id = ms.match_id"
    this.db.executeSql(query, []).then((data) =&gt; {
        this.matches = [];

        if(data.rows.length &gt; 0) {
            for(var i = 0; i &lt; data.rows.length; i++) {

                this.matches.push({
                  id: data.rows.item(i).id,
                  pointsPlayer1: data.rows.item(i).points_player1,
                  pointsPlayer2: data.rows.item(i).points_player2,
                  gamesPlayer1: data.rows.item(i).games_player1,
                  gamesPlayer2: data.rows.item(i).games_player2,
                });
            }
        }
        console.log(this.matches);


    }, (error) =&gt; {
        console.log("ERROR: " + JSON.stringify(error));
    });
</code></pre>

<p>Currently it returns for each set a new row.</p>

<pre><code>id    pointsPlayer1    pointsPlayer2    gamesPlayer1    gamesPlayer2
1          15               30               6               3                                   
1          15               30               2               6
1          15               30               2               3
2          30               0                7               6
2          30               0                2               1
</code></pre>

<p>And I would like to return it as multidimensional array. How can I do this in SQLite and Javascript? Thanks.</p>