How to use the alasql function in alasql

To help you get started, we’ve selected a few alasql examples, based on popular ways it is used in public projects.

Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.

github PatMurrayDEV / apple-music-history / src / components / Querier.jsx View on Github external
handleSubmit(event) {
        this.setState({
            result: alasql(this.state.query, [this.props.plays])
        });
    }
github PatMurrayDEV / apple-music-history / src / components / Querier.jsx View on Github external
componentDidMount() {
        this.setState({
            result: alasql(this.state.query, [this.state.plays])
        });
    }
github PatMurrayDEV / apple-music-history / src / components / MonthChart.jsx View on Github external
static getDerivedStateFromProps(nextProps, prevState) {
        return {
            months: alasql(`SELECT year, timeStamp->getMonth() as month, COUNT(id) as plays, SUM(duration) as duration FROM ? WHERE excluded = false GROUP BY year, timeStamp->getMonth() ORDER BY timeStamp ASC`,[nextProps.plays])
        };
    }
github PatMurrayDEV / apple-music-history / src / components / YearsTopSongs.jsx View on Github external
static getDerivedStateFromProps(nextProps, prevState) {
        var years = alasql(`SELECT COUNT(id) as plays, SUM(duration) as duration, year FROM ? WHERE excluded = false GROUP BY year ORDER BY year ASC`,[nextProps.plays]);
        for (let index = 0; index < years.length; index++) {           
            years[index].songs = alasql(`SELECT name, artist, COUNT(id) as plays, SUM(duration) as duration FROM ? WHERE year = ${years[index].year} AND excluded = false GROUP BY name, artist ORDER BY SUM(duration) DESC`,[nextProps.plays]);
        }
        return {
            years: years
        };
    }
github PatMurrayDEV / apple-music-history / src / components / YearsTopSongs.jsx View on Github external
static getDerivedStateFromProps(nextProps, prevState) {
        var years = alasql(`SELECT COUNT(id) as plays, SUM(duration) as duration, year FROM ? WHERE excluded = false GROUP BY year ORDER BY year ASC`,[nextProps.plays]);
        for (let index = 0; index < years.length; index++) {           
            years[index].songs = alasql(`SELECT name, artist, COUNT(id) as plays, SUM(duration) as duration FROM ? WHERE year = ${years[index].year} AND excluded = false GROUP BY name, artist ORDER BY SUM(duration) DESC`,[nextProps.plays]);
        }
        return {
            years: years
        };
    }

alasql

Use SQL to select and filter javascript data - including relational joins and search in nested objects (JSON). Export to and import from Excel and CSV

MIT
Latest version published 21 days ago

Package Health Score

89 / 100
Full package analysis