Quantcast
Channel: How to do this Query?
Viewing all articles
Browse latest Browse all 8

Re: How to do this Query?

$
0
0

sairam62.cse

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

having sum(b.price)<=x

Change to:

SELECT a.ProductID,  a.Price
FROM @Products a,  @Products b
WHERE b.ProductID <= a.ProductID
GROUP BY  a.ProductID, a.Price
Having SUM(b.Price)<1000
ORDER BY  ProductID, Price




Viewing all articles
Browse latest Browse all 8

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>