1

我想知道是否有办法做这样的事情。

select outsidecolumn, example1, example2
from (
    select exemple1,example2 
    from tablenames 
    inner joins
    where conditions) as p,
    table2 tb
    where p.example1 = tb.outsidecolumn
4

2 回答 2

0

我认为这就是你想要的:

select tb.outsidecolumn, p.example1, p.example2
from 
(
  select exemple1,example2 
  from tablenames 
  inner joins
  where conditions
) p
inner join table2 tb
  on p.example1 = tb.outsidecolumn
于 2013-01-24T13:36:46.187 回答
0

替代方法 - CTE

并且inner join虽然执行计划可能相同,但也不是笛卡尔坐标系,但可以说更具可读性。

with p as (
    select exemple1,example2 
    from tablenames 
    inner joins
    where conditions
)
select tb.outsidecolumn, p.example1, p.example2
from p
    join table2 tb
    on tb.outsidecolumn = p.example1
于 2013-01-24T13:39:41.467 回答