SQL or Appian Expression to Achieve a Unique Select

what I am looking for is a generic qry that will return the primary record when the case number is duplicate as shown in the image (242xxx)

  Discussion posts and replies are publicly visible