Skip to content
This repository was archived by the owner on Sep 7, 2021. It is now read-only.
This repository is currently being migrated. It's locked while the migration is in progress.
This repository was archived by the owner on Sep 7, 2021. It is now read-only.

CTE (Common Table Expression) with aliases support #1415

@typeless

Description

@typeless

After https://gitea.com/xorm/builder/pulls/59 we can do
Join(Select(...), ...)
It would be more useful if it can support aliases like the following SQLs (SQLite dialect):

WITH r AS (
  SELECT * 
  FROM 
  repository
), u AS (
  SELECT * 
  FROM 
  user
) SELECT 
  u.name, 
  r.name 
FROM 
  u 
JOIN 
  r ON u.id = r.owner_id;
SELECT 
  user.id, 
  r.name 
FROM 
  user 
JOIN (
  SELECT * 
  FROM 
  repository) AS r ON user.id = r.owner_id;

Note that builder.From supports aliases already. This issue is mainly about builder.Join.

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions