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?

SHOW CREATE TABLE My_Table\Gand asINSERT INTO My_Table VALUES(.....). This makes it easier to copy and paste and try out solutions.site, bldg, roomfrom both the select statement andshelffrom the group by. If that's not exactly what you need, then @Vérace looks like he's willing to sort you out if you post some DDL to work with