Skip to content

Enhance SQL function #1216

Open
Open

Description

@cmdares

It is suggested to add
1.ROW_NUMBER() OVER (PARTITION BY COL1 ORDER BY COL2)
2.Upsert https://www.postgresqltutorial.com/postgresql-upsert/
3.other window function: count|max|min|lead|lag|first_value|last_value over(PARTITION BY COL1 ORDER BY COL2)
4.CONCAT_WS() GROUP BY

Activity

  1. chapmanjacobd commented on May 31, 2022

    @chapmanjacobd

    Is there an alternative to ROW_NUMBER() OVER (PARTITION BY COL1 ORDER BY COL2) currently supported in alasql?

    I would like to limit the number of results by a specific group while keeping the order by

  2. chapmanjacobd commented on Jun 1, 2022

    @chapmanjacobd

    hmm... even UNION does not seem to work

    alasql` select entries.*
            , watched.id IS NOT NULL as watched
          from entries
          outer join watched on watched.id = entries.id and watched.ie_key = entries.ie_key
          join playlists on playlists.original_url = entries.original_url
          where entries.id not in (select distinct id from watched) and entries.original_url = "https://www.youtube.com/playlist?list=PLQhhRxYCuOXX4Ru03gUXURslatUNxk7Pm"
           order by random() limit 100
    UNION ALL
    select entries.*
            , watched.id IS NOT NULL as watched
          from entries
          outer join watched on watched.id = entries.id and watched.ie_key = entries.ie_key
          join playlists on playlists.original_url = entries.original_url
          where entries.id not in (select distinct id from watched) and entries.original_url = "https://www.youtube.com/watch?v=qopNCLDbD1M"
           order by random() limit 100` 

    The queries work fine individually but with the union all I get:

    Uncaught (in promise) TypeError: this.queriesfn is undefined
        anonymous alasql.js:3
        n3 alasql.min.js:2
        n3 alasql.min.js:2
        n3 alasql.min.js:2
        n3 alasql.min.js:2
        $ alasql.min.js:2
        L alasql.min.js:2
        fromTable alasql.min.js:2
        datafn alasql.min.js:2
        r2 alasql.min.js:2
        r2 alasql.min.js:2
        r2 alasql.min.js:2
        $ alasql.min.js:2
        L alasql.min.js:2
        fromTable alasql.min.js:2
        datafn alasql.min.js:2
        r2 alasql.min.js:2
        r2 alasql.min.js:2
    
  3. mathiasrw commented on Sep 25, 2022

    @mathiasrw
    Member

    queriesfn is undefined Seems to be a theme for UNION (also relevant to #1264)

    I have a feeling its a small fix, but hard to find where.

  4. mathiasrw commented on Dec 22, 2025

    @mathiasrw
    Member

    Findings

    Fully Implemented:

    • ✅ ROW_NUMBER() OVER (PARTITION BY col1 ORDER BY col2) - Tested in test/test1126.js
    • ✅ CONCAT_WS(separator, col1, col2, ...) - Tested in test/test413.js

    Not Implemented yet:

  5. imsanupm commented on Feb 28, 2026

    @imsanupm
    Contributor

    Hi, if no one is currently working on this issue, I’d love to give it a try. Could you please assign it to me? I’m curious and excited to work on this.

  6. mathiasrw commented on Apr 1, 2026

    @mathiasrw
    Member

    Happy to add you, however, please note that depending on the volume of the added code we might not include it until we have the setup for modular inclusion of functionality

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

Type

No type

Projects

No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions