我从2表miele和confmiele这样做了一个联盟:
SELECT datamiele, nomemiele, codicemiele, dataconfmiele, '' AS nomeconfmiele,
0 AS codiceconfmiele FROM miele
UNION ALL
dataconfmiele, '' AS nomemiele, 0 AS codicemiele, dataconfmiele, nomeconfmiele,
codiceconfmiele
FROM confmiele
结果是正确的但不是字段datamiele和dataconfmiele(是数据字段类型)
Result il like:
datamiele
323031332d30392d3031
为字段编号分配值0或为字段varchar分配varchar给出正确的值。但是我不知道分配给日期字段的是什么?
答案 0 :(得分:0)
通过映射精确别名来尝试这个
SELECT datamiele,
nomemiele,
codicemiele,
dataconfmiele,
'' AS nomeconfmiele,
0 AS codiceconfmiele
FROM miele
UNION ALL
SELECT dataconfmiele AS datamiele,
'' AS nomemiele,
0 AS codicemiele,
dataconfmiele,
nomeconfmiele,
codiceconfmiele
FROM confmiele
答案 1 :(得分:0)
谢谢你的解决方案 我从第一次选择
中纠正了一个“'AS dataconfmiele”我为其他人留下了解决方案
SELECT datamiele,
nomemiele,
codicemiele,
'' AS dataconfmiele,
'' AS nomeconfmiele,
0 AS codiceconfmiele
FROM miele
UNION ALL
SELECT dataconfmiele AS datamiele,
'' AS nomemiele,
0 AS codicemiele,
dataconfmiele,
nomeconfmiele,
codiceconfmiele
FROM confmiele
非常感谢