ERROR: syntax error at or near "DISTINCT"

Why am I getting this error? I need to select both of these options separately, but Im im coding this wrong here?

ERROR: syntax error at or near "DISTINCT"

SELECT DISTINCT(mfin_score), DISTINCT(empirica_score ) from account_details
+4
source share
5 answers

You can do:

select distinct mfin_score, empirica_score
  from account_details

The keyword is distinctnot a function. This is a keyword to indicate that you want to embed only tags distinctin your result set.

+4
source

DISTINCTis KEYWORDnot a FUNCTION, so it’s better to try

SELECT DISTINCT mfin_score, empirica_score from account_details
+3
source

SELECT DISTINCT mfin_score, empirica_score account_details

+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 Alias, , , oracle

+2
source

Valid DISTINCT keyword syntax

SELECT DISTINCT column_name,column_name FROM table_name;

So you can write

SELECT DISTINCT mfin_score, empirica_score from account_details

instead

SELECT DISTINCT(mfin_score), DISTINCT(empirica_score ) from account_details

+2
source

All Articles