Please start any new threads on our new
site at https://forums.sqlteam.com. We've got lots of great SQL Server
experts to answer whatever question you can come up with.
| Author |
Topic |
|
sital
Yak Posting Veteran
89 Posts |
Posted - 2008-12-11 : 05:47:08
|
| Hi allCan any one tell me in which cases we can use where and having clauses?Why do we use a having clause?What is the difference in using Where and Having Clause?Also, if a query contains both Where and Having Clause then which clause will be executed first? |
|
|
bklr
Master Smack Fu Yak Hacker
1693 Posts |
Posted - 2008-12-11 : 05:52:02
|
| Where Will be used to get particular records(condition)Having will be used when aggregate functions are used the condition will be checked by having clause it will follows after group by clause |
 |
|
|
Jai Krishna
Constraint Violating Yak Guru
333 Posts |
Posted - 2008-12-11 : 06:00:41
|
| When a Select Clause contains both Where and Having Clauses then Where Clause will be executed first and then the Having clause will be executedAfter the records are grouped by then we use Having clause to filter the recordsJai Krishna |
 |
|
|
|
|
|