Unable to Run Distinct On - Native Query

Hello,

I am not able to run a SELECT DISTINCT ON() function in Metabase using a native query. I am using a Postgres database. I would like to run the distinct function on only one field, while keeping the remaining fields in the table.

Thank you!
Stefan

Hi @saleksevitch
Post "Diagnostic Info" from Admin > Troubleshooting, and which version of Postgres you're querying.
What is preventing you from writing a query like that? Metabase sends the query to Postgres, so if you are getting an error, it's like caused wrong syntax.

1 Like

Gotcha - so this is an error on the server side (with the syntax) and not Metabase? Apologies for my ignorance here.

@saleksevitch
I have no idea without the following information:

  1. Post "Diagnostic Info" from Admin > Troubleshooting
  2. Which version of Postgres you're querying?
  3. Post the error you are getting - preferably the full stack trace from Admin > Troubleshooting > Logs