<!DOCTYPE html> <html> <head> <meta name="viewport" content="width=device-width, initial-scale=1.0" /> <meta charset="utf-8" /> <title>alasql</title> <script src="https://ss.netnr.com/alasql@4.4.0/dist/alasql.min.js"></script> </head> <body> </body> </html>
let data = [ { a: 1, b: 1, c: 1 }, { a: 1, b: 2, c: 1 }, { a: 1, b: 3, c: 1 }, { a: 2, b: 1, c: 1 } ]; let res1 = alasql('SELECT a, COUNT(*) AS b FROM ? GROUP BY a', [data]); console.debug(res1) /* create SQL Table and add data */ alasql("CREATE TABLE cities (city string, pop number)"); alasql("INSERT INTO cities VALUES ('Paris',2249975),('Berlin',3517424),('Madrid',3041579)"); var res2 = alasql("SELECT * FROM cities WHERE pop < 3500000 ORDER BY pop DESC"); console.debug(res2)