Can you please explain your requirement here in a bit more detail? For the first reading, I'd go for the SQL plugin: https://marketplace.atlassian.com/plugins/org.swift.confluence.sql
However, this is not likely to be used in an user macro. Please explain the use-case of the above and maybe we can point you to a different approach for the same solution.
Connect with like-minded Atlassian users at free events near you!Find a group
Connect with like-minded Atlassian users at free events near you!
Unfortunately there are no AUG chapters near you at the moment.Start an AUG