0
我想使用UNION连接两个视图(查看CSP包含1个列,所以我想在第二个视图的某些项目的情况下使用*作为第二个不在第一个视图中),这是工作不错,但我没有重复的配置ID或者有正确的值和*。与一个不同的列联盟
如何解决这个问题,并在csp中有值时用'*'去除行?
SELECT csp.customer_no,
csp.contract,
csp.customer_part_no,
csp.configuration_id,
csp.catalog_no
FROM customersomething csp
UNION
SELECT spc.customer_no,
spc.contract,
spc.customer_part_no,
'*' AS "configuration_id",
spc.catalog_no
FROM
superproduct spc
+-------------+----------+-----+------------------+--------+
| customer_no | contract | ... | configuration_id | |
+-------------+----------+-----+------------------+--------+
| 17 | whatever | ... | * | view A |
| 17 | whatever | ... | right_one | view B |
+-------------+----------+-----+------------------+--------+