0

请大家我需要有关选择语法的帮助。

我需要从连接中合并两个选择结果。

我试着解释

SELECT FROM 2 TABLE BY JOIN 
UNION
SELECT FROM 2 OTHER TABLE BY UNION

或者

我试过了:

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

我希望我解释了。

4

2 回答 2

1
select * 
from taba1 
left join taba2 
on taba1.col=taba2.col

union

select * 
from tabb1 
left join tabb2
 on tabb1.col=tabb2.col
于 2013-10-10T09:53:51.027 回答
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
于 2013-10-10T09:54:08.040 回答