Hi,
Please supply more details to allow every one able to, clearly, understand what you need.
However,
SELECT field_2 FROM table WHERE field_1 = 'a' ORDER BY field_2 ASC
This was the sql which will return as a query result 1,2,3,4 Of course after looping through the result array and you can add a before the loop start.