Sql select only first occurrence