How to query the most recent reference of multiple inputs and display in a table

After a lot of playing around, I’ve managed to get the most recent journal reference to a page link by sorting the result and taking the last value. However, I’m now trying to get this same result for an array of inputs and display the resulting journal page names in table. As a bonus, it would be extremely useful to show how many days in the past the journal pages are.

This is what I’ve got so far which provides the journal page name for a single input:

#+BEGIN_QUERY
{
	:query [
    	:find (pull ?p [*])
		:in $ ?name
		:where
			[?b :block/page ?p]
			[?p :block/journal-day ?d]
			[?b :block/refs ?r]
			[?r :block/name ?name]
    ]
	:inputs ["person 1"]
	:result-transform (fn [result]
    	(->> result
        	(sort-by (fn [h] (get h :block/journal-day) ) >)
        	(take 1)
        )
    )
}
#+END_QUERY