I have a situation to grab rows with a minimum value of a certain column. Below is the image of my made up table to explain what I am trying to do.
I need to pull one record per instance_oid with the minimum shelf number. I wrote the query like this:
select instance_oid, site, bldg, room, min(shelf) group by instance_oid, site, bldg, room, shelf
This gives same record in multilpe rows (as many rows as I have for each instance_oid). How do I make sure I get only one record, i.e, the one with the min(shelf) as I highlighted in the attached image?