Skip to content

CROSS LATERAL APPLY possible? #127

@xdbr

Description

@xdbr

Impressive work @mithrandie and such a fanstastic library!

I was wondering whether the following scenario is already possible or how difficult it would be to implement something along these lines:

Example: Join Each Product to Its Tags
Suppose you have a table:

products
---------
id   name       tags
1    Phone      electronics,mobile
2    Laptop     electronics,computer
3    Shoes      fashion,footwear

You want to get one row per tag per product:

SELECT
  p.id,
  p.name,
  s.value AS tag
FROM
  products p
CROSS APPLY STRING_SPLIT(p.tags, ',') AS s;
id name tag
1 Phone electronics
1 Phone mobile
2 Laptop electronics
2 Laptop computer
3 Shoes fashion
3 Shoes footwear

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions