sqlor
1
Hello
I am having an issue with a join, can you help me please?
SELECT tbl1.C1 FROM T1 tbl1
INNER JOIN (SELECT C1, MIN(C2) FROM T2 WHERE C3=1 GROUP BY C1) tbl2 ON tbl1.C1=tbl2.C2
I get an error when trying to reference the inner selection as tbl2.
How can I do it please?
tbl2.C2
should come from the inner query
to be able to use it in the outer join
sqlor
3
You mean the below?
SELECT tbl1.C1 FROM T1 tbl1
INNER JOIN (SELECT C1, MIN(C2) FROM T2 tbl2 WHERE C3=1 GROUP BY C1) ON tbl1.C1=tbl2.C2
It does not seem to work either!
Ifor
4
Derived tables, views etc require names for all their columns.
I suspect the error told you this.
RTFI
select * from ( select c1 , c2 from table25 ) xyz join table2 on xyz.c2 = table2.c2
1 Like