-
Expert Member
Writeing a query with HAVING clause
how can I write HAVING query! can please lem me know thanks.
NOTE : [This question was asked by patel]
-
Expert Member
Re: Writeing a query with HAVING clause
Hi Patel,
Go to quick links, click on private messages,click on new messages.Post ur query it will automatically come on forum.
I hope your query solve.Plz revert me with feed back or any further query.
Thanks & Regards
Nikhil Rattan
-
Expert Member
Re: Writeing a query with HAVING clause
Hi Patel,
The HAVING clause is used in combination with the GROUP BY clause. It can be used in a SELECT statement to filter the records that a GROUP BY returns.
HAVING clause is used with aggregate_function like SUM, COUNT, MIN, or MAX.
Let me give an HAVING clause example with COUNT function.
SELECT dept_no, COUNT(*)
FROM employees
WHERE salary > 25000
GROUP BY dept_no
HAVING COUNT(*) > 10;
This example will select the No. of employees of all deptartments with salary greater than 25000. Here the HAVING clause filters the records with departments which have more than 10 employees.
Similarly other aggregate functions can be used.
Hope its clear :-)
*** Mangai Varma ***
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules