我正在尝试为我创建的 2 个选择语句的 UNION 创建一个视图。
单独执行时,UNION 工作正常
但问题是当我将它作为视图执行时,只有 UNION 的第一部分被执行。
我正在使用的查询如下
SELECT DISTINCT
products.pid AS id,
products.pname AS name,
products.p_desc AS description,
products.p_uid AS userid,
products.p_loc AS location,
products.isaproduct AS whatisit
FROM products
UNION
SELECT DISTINCT
services.s_id AS id,
services.s_name AS name,
services.s_desc AS description,
services.s_uid AS userid,
services.s_location AS location,
services.isaservice AS whatisit
FROM services
当我单独执行时,上述工作正常。但是当我将它用作视图时,它并没有给我服务部分的结果。
有人可以帮我吗?