select field1,
       field2,
       field3=(select count(*) from A where A.field2<=aa.field2)
from A aa