请大家,我需要有关select语法的帮助。
我需要从join中选择两个select结果。
我试着解释
SELECT FROM 2 TABLE BY JOIN
UNION
SELECT FROM 2 OTHER TABLE BY UNION
OR
我试过了:
select .... join.... data from table2for union
union
select .... join ... data from table1 for union
我将联合的表是2表的连接结果。
了解其他数据:
tabA1
codice
nome
totale
JOIN
tabA2
restocodice
restonome
UNION
tabB1
codiceconf
nomeconf
totaleconf
JOIN
tabB2
restocodiceconf
restonomeconf
我希望我解释过。
答案 0 :(得分:1)
select *
from taba1
left join taba2
on taba1.col=taba2.col
union
select *
from tabb1
left join tabb2
on tabb1.col=tabb2.col
答案 1 :(得分:1)
这是一般结构:
SELECT cols
FROM table1
JOIN table2 ON join-conditions
WHERE more-conditions
UNION
SELECT cols
FROM table3
JOIN table4 ON join-conditions
WHERE more-conditions