查询失败 'ORA-00923: FROM keyword not found where expected'

Query fails with 'ORA-00923: FROM keyword not found where expected'

select pl.label_id,
( select pv.label_value 
from PV_I18N_ACTIVE_LOCALE_LABEL pv 
where pv.locale_id='English' 
and pv.label_type_id = 'LABEL'
and pv.label_id = pl.label_id ) as 'English',
( select pv.label_value 
from PV_I18N_ACTIVE_LOCALE_LABEL pv 
where pv.locale_id='Hindi' 
and pv.label_type_id = 'LABEL'
and pv.label_id = pl.label_id ) as 'Hindi',

from PV_I18N_ACTIVE_LOCALE_LABEL pl
where pl.label_type_id = 'LABEL'
order by pl.label_id

错误是

ORA-00923: FROM keyword not found where expected

您的 SQL 中有额外的 ,,就在 FROM 关键字之前。

and pv.label_id = pl.label_id ) as 'Hindi',

from PV_I18N_ACTIVE_LOCALE_LABEL pl

==已编辑==

我不确定,您为什么要使查询如此复杂,而查询可以轻松完成。你为什么要使用内联查询,而同样的事情你可以通过使用 CASE 语句来实现。

select CASE WHEN pl.locale_id='English' THEN 
pl.label_value 
END  as 'English',
CASE WHEN pl.locale_id='Hindi' THEN 
pl.label_value 
END  as 'Hindi'  from PV_I18N_ACTIVE_LOCALE_LABEL pl where pl.label_type_id = 'LABEL';

删除关键字前的“,”