我的高级技术人员准备了一个观点。查看源脚本,我无法理解列label
的存在位置,因为两个表都不包含该列。它是一个作为视图的一部分存在的列 - 在运行中吗?
select label labelName
, e.name
, e.country
from entity e
源脚本:
SELECT e.entity_id
, se.screen_id
, s.country_code
,desc_trans translatedValue
, et.language_code
, cp.NAME name
FROM entity e
LEFT OUTER JOIN CONTROL_PREFIX cp
ON e.CONTROL_PREFIX_CODE = cp.CONTROL_PREFIX_CODE
, entity_trans et
, screen s
, screen_entity se
WHERE e.entity_id = et.entity_id
AND e.entity_id = se.entity_id
AND se.screen_id = s.screen_id
AND e.entity_type_code = 'LB'
UNION
SELECT e.entity_id
, se.screen_id
, s.country_code
, field_name labelName
, label labelText
, NULL translatedValue
, l.language_code
, cp.NAME name
FROM entity e
LEFT OUTER JOIN CONTROL_PREFIX cp
ON e.CONTROL_PREFIX_CODE = cp.CONTROL_PREFIX_CODE
, language l
, screen s
, screen_entity se
WHERE l.language_code NOT IN
(
SELECT et1.language_code
FROM entity e1
, entity_trans et1
WHERE e1.entity_id = et1.entity_id
AND e1.entity_id = e.entity_id
AND e1.entity_type_code = 'LB'
)
AND e.entity_type_code = 'LB'
AND s.screen_id = se.screen_id
AND e.entity_id = se.entity_id;
答案 0 :(得分:0)
假设您发布的SQL是用于生成视图的SQL并且已完成
即
create view myView as
select label labelName
, e.name
, e.country
from entity e
列Label
位于表Entity
上,但在myView
视图中显示为LabelName
。
如果entity
是视图的名称,则需要提供该视图背后的来源。