mercredi 6 janvier 2016

grouping the record basis of different criteria

I have table like bellow how to write a workable code.

code    type    date        amount  qty
2001    Advance 1/1/2015    200     0
3001    Advance 2/5/2015    0       0
2001    Balance 12/30/2015  500     1
3001    Balance 5/5/2015    200     1
3002    Advance 1/3/2015    100     0

I need to select only the item with it's balance received and total amount also need to show in full like:

code    type    date        totalamount qty
3001    closed  5/5/2015    200         1
2001    Closed  12/30/2015  700     `   1

Aucun commentaire:

Enregistrer un commentaire