Posted: select document_no, sum(trx_amount) as Amount from "gl_posted_trxs" group by document_no having Amount <> 0;

 

Unposted: select document_number, sum(trx_amount) as Amount from "gl_unposted_trxs" group by document_number having Amount <> 0;