Select rows other than first selected row in a table My table looks like

 id     ledgerID    Amount  Debit or credit     TransactionType
 --------------------------------------------------------------
  1         1        500       dr               Sale1
  2         2        300       cr               sale1
  3         3        400       dr               sale1
  4         1        1000      dr               sale2
  5         2        200       cr               sale2


Now I like to select this table like

sno  LedgerID   Transaction     Dr        Cr
-----------------------------------------------
1    1          sale1          500
         2      300 cr
         3      400 dr
2    1          sale2         1000
         2      200 cr


How to do this?
You can split the debit/credit columns using a CASE syntax:

(CASE WHEN [Debit or credit]='cr' THEN Amount END) AS cr,
(CASE WHEN [Debit or credit]='dr' THEN Amount END) AS dr


As for the "sno" column, I presume that the answer you're looking for is something like

DENSE_RANK() OVER (ORDER BY TransactionType) AS sno