Can Having clause be used without Group by clause?
Answers were Sorted based on User's Feedback
Answer / phani
we can use, but select columns and having columns should
use with aggregare functions
ex:
select max(empid), min(marks)
from employee
having max(empid_id)>100
Is This Answer Correct ? | 72 Yes | 16 No |
Answer / debasish
we can use having clause without group bu clause .but it
will act as where clause
Is This Answer Correct ? | 68 Yes | 33 No |
Answer / sumathy
HAVING Clause
Specifies a search condition for a group or an aggregate.
HAVING is usually used with the GROUP BY clause. When GROUP
BY is not used, HAVING behaves like a WHERE clause.
Reference:
http://msdn.microsoft.com/en-us/library/aa259187
(SQL.80).aspx
Is This Answer Correct ? | 30 Yes | 3 No |
Answer / pradip jain
select max(empno) from dbo.Employee having count(EmpNo)=9
it has no meaning so it will show zero record
Is This Answer Correct ? | 17 Yes | 6 No |
Answer / shailesh yadav
Yes HAVING caluse can be use without GROUP BY. the SQL HAVING clause is often used with the GROUP BY clause. If the GROUP BY clause is omitted, the MySQL HAVING clause behaves like the WHERE clause. Notice that the MySQL HAVING clause applies the condition to each group of rows, while the WHERE clause applies the condition to each individual row.
Is This Answer Correct ? | 6 Yes | 2 No |
Answer / anilreddy
No,we can not use.If there is Having it must followed by Group By
Is This Answer Correct ? | 6 Yes | 52 No |
Difference between server.transfer and server.execute method?
What is the return type of executeupdate ()?
How do you troubleshoot SQL Server if its running very slow?
in the physical file layout, where should the transaction log be stored in relation to the data file? : Sql server administration
How to display n-1 columns from n number of columns, from a single table in MS SQL server 2005?
What is dbcc command in sql server?
If there is failure during updation of certain rows, what will be the state?
What is the maximum length of an alert name?
how do u do Performance tunning ?
1 Answers Infodat Technologies, Satyam,
Explain cursor as data base object?
Define union, union all, minus, intersect?
Define self join?