socratasoda

Trouble putting together a SoQL query with Socrata


I have this query that I put together in MySQL in my test db and am trying to figure out how to port it over to the SoQL SODA API. Pretty much just trying to get a list of the unique business and associated details.

SELECT DISTINCT
    (CAMIS), dba, boro, building, street
FROM
    nyc_stuff.restauraunt_inspections
WHERE
    BORO = 'BRONX';

This is the base url I'm using:

https://data.cityofnewyork.us/resource/xx67-kt59.json

I'm aware of how to use the clauses, but can't figure out how to add Distinct into the query.

I tired this:

https://data.cityofnewyork.us/resource/xx67-kt59.json?$select=DISTINCT%20(CAMIS)

But no luck...


Solution

  • You can accomplish this by using the $query parameter in SoQL. I would suggest:

    https://data.cityofnewyork.us/resource/xx67-kt59.json?$query=SELECT%20distinct%20camis,%20dba,%20boro,%20building,%20street%20WHERE%20boro%20=%20%22BRONX%22
    

    Thanks, Socrata Support