Fix query by record