Create view inv_info as Select distinct a.invnumber as Inv, a.transdate, ct.customernumber as Cust, ct.name, p.partnumber as Part, i.description, i.qty, p.unit, p.weight, i.sellprice, (i.qty*i.sellprice)::numeric(7,0)as Subtotal from invoice i, ar a, parts p, customer ct where a.id = i.trans_id and p.id = i.parts_id and a.customer_id = ct.id and i.sellprice >0;