Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

ERROR: syntax error at or near "DISTINCT"

Tags:

postgresql

Why do I get this error? I need to select both these as distinct, but Im I coding it wrong here?

ERROR: syntax error at or near "DISTINCT"

SELECT DISTINCT(mfin_score), DISTINCT(empirica_score ) from account_details
like image 371
morne Avatar asked Dec 07 '22 00:12

morne


2 Answers

You can do:

select distinct mfin_score, empirica_score
  from account_details

Keyword distinct is not a function. It's a keyword to state that you want only distinct tuples on your result set.

like image 51
Pablo Santa Cruz Avatar answered Dec 28 '22 12:12

Pablo Santa Cruz


DISTINCT is a KEYWORD not a FUNCTION hence it will be better if you try

SELECT DISTINCT mfin_score, empirica_score from account_details
like image 20
Satya Avatar answered Dec 28 '22 12:12

Satya