我的查询:
CREATE OR REPLACE VIEW Basic
AS
SELECT id FROM my_post
UNION
SELECT id FROM scrap_post
如果该行来自my_post
,那么我想设置标记p
,否则设置s
。
答案 0 :(得分:3)
添加硬编码值
CREATE OR REPLACE VIEW Basic
AS
select id,'p' as flag from my_post
UNION
select id,'s' from scrap_post
注意:如果您不关心结果中的重复项,请将UNION
更改为运行速度更快的UNION ALL