Tuesday, July 10, 2012

aggregate functions in where/having clause

sum, avg, count, min, max, and count(*).these are sql functions to calculate and
summarize data


but it can be possible to use these function in query condition clause
Example : product_stock contains purchase sale

detail of product we have to find product
whose stock is greater than 100
here is,

select product_id, product_name from
product_master inner join on product_stock on
product_master.product_id=product_stock.product_id
group by product_id, product_name
having Sum(product_stock.stock_value)>100

No comments:

Post a Comment

Save a PDF generated from html2pdf in C#, MVC , html2pdf , Ajax code

 To save on server or disk a PDF generated from HTML in C# code example, you can use the      html2pdf js script     html2pdf   converts any...