为什么会出现此错误?我需要选择这两个区别,但我在这里编码错了吗?
ERROR: syntax error at or near "DISTINCT"
SELECT DISTINCT(mfin_score), DISTINCT(empirica_score ) from account_details
答案 0 :(得分:4)
你可以这样做:
select distinct mfin_score, empirica_score
from account_details
关键字distinct
不是函数。这是一个关键字,表示您只需要distinct
个结果集上的元组。
答案 1 :(得分:4)
DISTINCT
是KEYWORD
而非FUNCTION
,因此如果您尝试
SELECT DISTINCT mfin_score, empirica_score from account_details
答案 2 :(得分:2)
只需使用此
SELECT DISTINCT mfin_score,来自account_details的empirica_score
答案 3 :(得分:2)
如果你想要mfin和empirica的独特夫妻:
select distinct mfin_score, empirica_score
from account_details
如果你想要独特的mfin和独特的经验,你必须做一些不同的事情:
select distinct 'MFIN' As code, mfin_score
from account_details
union all
select distinct 'EMP' As code, empirica_score
from account_details
您可能需要检查postgresql for Alias的语法,不确定它是否与oracle相同
答案 4 :(得分:2)
DISTINCT关键字的正确语法是
SELECT DISTINCT column_name,column_name
FROM table_name;
所以你可以写
SELECT DISTINCT mfin_score, empirica_score from account_details
而不是
SELECT DISTINCT(mfin_score), DISTINCT(empirica_score ) from account_details