$ 0 0 select a.product,sum(b.price) as totprice from table a,table b where a.sno<=b.sno group by a.producthaving sum(b.price)<=x