Query result formatting.