How do I convert SQL output to an index?

Hey guys,
I am looking to convert my SQL results into an index in order to perform visualizations on it. What is the best way to get it to work?