One thing I alwys forget how to do is to add a sequential number to a query output in SQL. Using the rank function you can get this. A query such as
select rank() OVER (ORDER BY accountid) as xrank, account, accountid from account
Will return the accountid and a sequential number based on the AccountID sort order.
Similarly you can do something like this to sequence the results based on a sort on account names:
select rank() OVER (ORDER BY account) as xrank, account, accountid from account
