Skip to content

Tag: sql

Calculate distance and only get one result for every trail_part_id

What I want to achieve is to get only the closest result for every trail_part_id. However I am stuck, I tried to use GROUP BY trail_part_id, but that did not work either as I got the following error message: SELECT list is not in GROUP BY clause and contains nonaggregated column ‘p.latpoint’ which…

Getting bounds in result with width_bucket

I’m trying to do a query using width_bucket and having a column in the results with the bounds of my buckets. Is there a simple way to do this? My query: Result: What I’m trying to get: Answer As you have a fixed sets of buckets, another option is to join against a list of ranges:

Get array size in oracle sql

I have a table in oracle with this definition Document is stored in a json format. How can i extract size for array parameters in sql? I need extract array size for each table record, and after sum all this values. ex: 1 step: 2 step: Can someone please give me an idea how to do that ? Answer Provided

Suggest SQL query for given use case

Original Table Expected Table I want all the distinct ids who have status as F but time should be maximum, if for any id status is T for given maximum time then that id should not be picked. Also only those ids should be picked who have at-least one T. For e.g 4 will not be picked at it doesn’t