New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Lateral derived tables [CORE3435] #3797
Comments
Commented by: Sean Leyne (seanleyne) JOINs to derived/abstract tables is supported using the following either of the following approaches: 1 - a variation on your original query SELECT ... OR 2 - the use of Common Table Expressions (CTE) WITH T3 AS ( |
Commented by: mauro russo (mauro) Dear Sean, I tried solution1 (with "on 1 = 1", exactly like you wrote) before to post the request, I am using Firebird 2.1 As a detail of your solution, Finally, I were using a solution similar to your solution2, but adapting the query to my case. |
Commented by: @dyemanov This request explicitly violates the SQL standard. Derived tables have to be independent from other contexts. |
Commented by: @hvlad What about LATERAL joins ? |
Modified by: @pcisarstatus: Resolved [ 5 ] => Closed [ 6 ] |
Commented by: @dyemanov Vlad is correct, the recent standard versions contain a description (although quite brief) of the requested feature. It declares the LATERAL keyword in front of the derived table definition and allows that derived table to reference priorly defined contexts of the same level. It can be used with INNER and LEFT joins only. |
Modified by: @dyemanovComponent: Engine [ 10000 ] description: I would like to have the following SQL feature. I would like to use a derived table, in a nested join, for which the definition For example : select * from T1 With such a select, I can "attach" to my query result a column [A.col1] to each row according to the column values => I would like to have the following SQL feature. I would like to use a derived table, in a nested join, for which the definition For example : select * from T1 With such a select, I can "attach" to my query result a column [A.col1] to each row according to the column values summary: derived dipendent tables => Lateral derived tables |
Commented by: @dyemanov Reopened because of the discovered support in the SQL standard. |
Commented by: mauro russo (mauro) Dears, really my beginning query used LEFT JOIN. I did not report the keyword LEFT because I thought it was not a basic for derived tables in my case. Well, I'll try again my query and I will post the full description of my tables and the full query text. Thanks again for support. |
Commented by: @livius2 All LATERAL joins can be changed to WITH RECURSIVE |
Commented by: @hvlad I also consider LATERAL DERIVED TABLE as valuable feature and good to have it in Firebird |
Modified by: @dyemanovassignee: Dmitry Yemanov [ dimitr ] |
Modified by: @dyemanovFix Version: 4.0 Beta 1 [ 10750 ] |
Modified by: @dyemanovFix Version: 4.0 Beta 1 [ 10750 ] => |
Commented by: @dyemanov Committed into v4 Beta 2. Error reporting is still pending some improvements, but the feature is basically ready for public testing. |
Modified by: @dyemanovstatus: Reopened [ 4 ] => Resolved [ 5 ] resolution: Fixed [ 1 ] Fix Version: 4.0 Beta 2 [ 10888 ] |
Modified by: @pavel-zotovstatus: Resolved [ 5 ] => Resolved [ 5 ] QA Status: Done with caveats Test Details: NB: currently test contains only initial (trivial) examples. To be continued later. |
Modified by: @pavel-zotovstatus: Resolved [ 5 ] => Closed [ 6 ] |
Modified by: @pavel-zotovstatus: Closed [ 6 ] => Closed [ 6 ] Test Details: NB: currently test contains only initial (trivial) examples. To be continued later. => NB: currently test contains only initial (trivial) examples. To be continued later. |
Submitted by: mauro russo (mauro)
Votes: 9
I would like to have the following SQL feature.
I would like to use a derived table, in a nested join, for which the definition
assume a eaning only according to the result of previous join.
For example :
select * from T1
join T2 on ....
join lateral (select A.col1 from A where A.col2 = T2.colX order by A.col2 rows 1)
...
With such a select, I can "attach" to my query result a column [A.col1] to each row according to the column values
of each row generated by the previous joins. Of course, in this case a new derived table has to be computed
for each row generated by the previous joins, but this way to write seems to be more easy and fast
respect using nested queries.
====== Test Details ======
NB: currently test contains only initial (trivial) examples. To be continued later.
Find issue with DT (but perhaps it is my mistake there). Sent sample to dimitr, 07.04.2020 21:18.
The text was updated successfully, but these errors were encountered: