Creating an advanced crosstab in PostgreSQL
===

I'm wondering how I can create a tables within sql that show a crosstab between two variables. In particular, I'd like to see a percentage total within each column and also an overall percent.

Below is a picture of the desired result
![enter image description here][1]

---
These are the current queries:

select  status
, letter
, count(*) cnt
-- (only for Query 2), round((count(*)::decimal  / (select count(*)from MYTABLE)),2) cnt_pct

from MYTABLE
group by cube(number, letter)
order by number, letter;


  [1]: http://i.stack.imgur.com/ByKNx.jpg