2010-09-20 8 views

Odpowiedz

7

Nie można bezpośrednio nazwać wyniku sprzężenia. Jedną z opcji jest użycie podzapytania:

select T.id 
from (
    select * 
    from table1 
    inner join table2 on table1.x = table2.y 
    inner join table3 on table3.z = table1.w 
) T 

Inną opcją jest podzapytanie faktoring:

with T as (
    select * 
    from table1 
    inner join table2 on table1.x = table2.y 
    inner join table3 on table3.z = table1.w 
) 
select T.id 
from T 
8

Nie można używać aliasów do nadaj nazwę „cały” dołączyć można jednak umieścić aliasy na poszczególnych stołach z przyłączyć:

select t1.id 
from table1 t1 
    inner join table2 t2 on t1.x = t2.y 
    inner join table3 t3 on t3.z = t1.w 

W projekcji, trzeba będzie użyć aliasu tabeli, która określa kolumnę id idziesz do select.

Powiązane problemy