我们说我有桌子
产品
model speed type
1001 1 pc
1002 2 pc
1003 1 pc
2001 null laptop
2002 null laptop
笔记本
model speed screen
2001 1 12
2002 2 13
我想要表
model speed screen type
1001 1 null pc
1002 2 null pc
1003 1 null pc
2001 1 12 laptop
2002 2 13 laptop
我的尝试
SELECT
product.model
FROM Laptop LEFT JOIN product
ON (product.model = laptop.model)
UNION
SELECT
product.model
FROM Laptop RIGHT JOIN product
ON (product.model = laptop.model)
我会得到"速度不明确"错误。怎么解决?
答案 0 :(得分:0)
尝试此查询
SELECT
product.model, laptop.speed
FROM Laptop LEFT JOIN product
ON (product.model = laptop.model)
UNION
SELECT
product.model, product.speed
FROM Laptop RIGHT JOIN product
ON (product.model = laptop.model)