Alasql: Can I get an Array of Arrays instead of an Array of Objects?

Created on 24 Mar 2016  路  1Comment  路  Source: agershun/alasql

Is it possible to get an Array of Arrays from a query instead of an Array of Objects?

I mean, instead of this:

var result = alasql('SELECT field1, field2 FROM table_name');
// result = [{field1: "value1", field2: "value2"}, {field1: "value3", field2: "value4"}]

This:

var result = alasql('SELECT field1, field2 FROM table_name');
// result = [["value1", "value2"], ["value3", "value4"]]

I know I can do it myself afterwards, but maybe there is a way of telling alasql to do it internally so that the results are not iterated over again by me. If result has 300k rows * 10 fields this makes a difference.

! Question

Most helpful comment

By prepending MATRIX OF before SELECT you will get what you are looking for.

var result = alasql('MATRIX OF SELECT field1, field2 FROM table_name');
// result = [["value1", "value2"], ["value3", "value4"]]

https://github.com/agershun/alasql/wiki/Matrix

>All comments

By prepending MATRIX OF before SELECT you will get what you are looking for.

var result = alasql('MATRIX OF SELECT field1, field2 FROM table_name');
// result = [["value1", "value2"], ["value3", "value4"]]

https://github.com/agershun/alasql/wiki/Matrix

Was this page helpful?
0 / 5 - 0 ratings

Related issues

daffodilistic picture daffodilistic  路  3Comments

DickSwart picture DickSwart  路  6Comments

morrme picture morrme  路  5Comments

songokudbz picture songokudbz  路  5Comments

thierrygervais picture thierrygervais  路  6Comments