tastott / jsoql

A SQL-like language for querying JSON data
http://tastott.github.io/jsoql
3 stars 1 forks source link

Recursive queries #101

Open tastott opened 8 years ago

tastott commented 8 years ago

This would be useful for transforming tree structures.

tastott commented 8 years ago

These could be implemented as parameterized queries which may refer to themselves in sub-queries.

-- Declare the parameterized query
WITH
(
    SELECT
        Blah AS Thing,
        (SELECT * FROM MyQuery(Children)) AS ThingChildren -- Recursive sub-query over Children array property
     FROM
        @@Table -- Special identifier for table parameter
) AS MyQuery

-- Use it with anything which would normally go in a FROM clause
SELECT * FROM MyQuery('file://test.json')