Skip to content
This repository has been 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.

CTE (Common Table Expression) with aliases support #1415

Open
typeless opened this issue Sep 6, 2019 · 0 comments
Open

CTE (Common Table Expression) with aliases support #1415

typeless opened this issue Sep 6, 2019 · 0 comments
Labels

Comments

@typeless
Copy link

typeless commented Sep 6, 2019

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.

@lunny lunny added the proposal label Sep 6, 2019
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
Projects
None yet
Development

No branches or pull requests

2 participants