Ha senso effettuare 2 query annidate su un'unica tabella?

Es.

SELECT DISTINCT stato FROM tabella
while (cicla fin tanto che trovi stati distinti nel campo stato)
metto in array_stati

for i=1 to count(array_stati)
SELECT * FROM tabella WHERE stato=array_stati(i)
echo tutti i dati relativi a quello stato
exit for

exit while