Compose a query to get a complete record against max

In the Ecto.Query.API. We use max in a select to fetch the max value in that field.

from q in jobs,
 select: max(q.cost)

My question is how can we compose a query that it will return a complete record against the max value instead of just max field value.

Not entirely sure what you mean by “against the max value” but if you’re after what I think you are you can use select_merge instead of select