October 23, 2012 at 11:18 am
Something like this
select join_alias.col11, join_alias.col21 from
(table1 a INNER JOIN table2 b ON a.col11=b.col21) join_alias
Hope it makes sense.
Please let me know.
October 23, 2012 at 11:42 am
icata (10/23/2012)
Something like thisselect join_alias.col11, join_alias.col21 from
(table1 a INNER JOIN table2 b ON a.col11=b.col21) join_alias
Hope it makes sense.
Please let me know.
Don't think it exists in a format similar to the one you specified above, but you could potentially use a VIEW that does the join, which then you could alias in your main query.
So something like:
select join_alias.col11, join_alias.col21
from vw_Tbl1JoinTbl2OnCol1 as join_alias
-----------------
... Then again, I could be totally wrong! Check the answer.
Check out posting guidelines here for faster more precise answers[/url].
I believe in Codd
... and Thinknook is my Chamber of Understanding
October 23, 2012 at 12:13 pm
There's no need to create a view. You'll end up with millions of views that you won't use.
You need to specify the complete query, not just the join. Something like this.
SELECT join_alias.col11,
join_alias.col21
FROM
(SELECT a.col11, b.col21
FROM table1 a
INNER JOIN table2 b ON a.col11=b.col21) join_alias
You can add as many columns as you need to your subquery.
October 23, 2012 at 12:19 pm
Luis Cazares (10/23/2012)
There's no need to create a view. You'll end up with millions of views that you won't use.
+1
or even use a CTE.
-----------------
... Then again, I could be totally wrong! Check the answer.
Check out posting guidelines here for faster more precise answers[/url].
I believe in Codd
... and Thinknook is my Chamber of Understanding
October 23, 2012 at 12:43 pm
ib.naji (10/23/2012)
Luis Cazares (10/23/2012)
There's no need to create a view. You'll end up with millions of views that you won't use.+1
or even use a CTE.
+1 again for the CTE
with join_alias as
(SELECT a.col11, b.col21
FROM table1 a
INNER JOIN table2 b ON a.col11=b.col21)
select col11,col21
from join_alias
__________________________________________________
Against stupidity the gods themselves contend in vain. -- Friedrich Schiller
Stop, children, what's that sound? Everybody look what's going down. -- Stephen Stills
Viewing 5 posts - 1 through 4 (of 4 total)
You must be logged in to reply to this topic. Login to reply