what is the difference between group and having
give an example with query and sample output
Answer Posted / manub22
- GROUP BY clause works on the rows returned by a SELECT Query. This clause summaries identical rows into a single/distinct group and returns a single row with the summary for each group, by using appropriate Aggregate function in the SELECT list, like COUNT(), SUM(), MIN(), MAX(), AVG(), etc.
- HAVING clause works as a Filter on top of the Grouped rows returned by the Query containing the GROUP BY clause. This clause cannot be replaced by a WHERE clause and vice-versa.
Check the difference b/w GROUP BY & HAVING, link: http://sqlwithmanoj.com/2015/05/23/sql-basics-difference-between-where-group-by-and-having-clause/
| Is This Answer Correct ? | 0 Yes | 0 No |
Post New Answer View All Answers
What do you mean by an execution plan? Why is it used? How would you view it?
What is the concept of optimization?
How to resolve the orphan use problem? : sql server security
What is the difference between Triggers and Stored Procedure?
I have a table Events Events containing cardno,time,id,name--each id has a cardno my requirement is every day each employee swipe the card several times i want to calculate first and last time of each card the output should be name 1 2 6 7 in out in out holiday holiday xxx 09:30 06:30 09:40 06:45 where 1,2...... are dates for example january 1,2, etc. 6 and 7 are saturday and sunday how it is posssible
What is the use of commit?
What is the difference between clustered and a non-clustered index?
Explain cross join or cartesian product in sql?
What program is used to store the data source file?
Define full outer join?
Can we insert data into view sql server?
What is sqlcmd?
What is Federation Root Database?
What are the advantages of mirroring?
What is difference between stored procedure and user defined function?