How can I add row number to a query

How can I add row number to a query

Hi, I want to display a query table like this:

I have this info:


-------------- ---------------------- user status -------------- ---------------------- John active Jane active Lewis inactive Mary inactive Marge active
and I want to show it like this


-------------- ---------------------- active inactive -------------- ---------------------- John Lewis Jane Mary Marge 

Since I cannot use the value of the current row in a sub query, I cannot use variables or row numbers, how can I achieve this?