Logic errors are the hardest kind of bugs to find.
Depending on the implementation, if you were trying it in an example like the above on a table that had been filled in sequentially, it might frequently pick the minimum row. So it would look like it was doing something, even when it wasn't.
Cheers,
Ben