0

sample table:

 create table #dev (name varchar(20), team varchar(10), qualification varchar(10))

 insert into #dev values
  ('a','t','be')
 ,('b','d','bsc')
 ,('c','p','be')
 ,('d','j','be')
 ,('e','d','bsc')
 ,('f','j','bsc')
 ,('g','d','be')
 ,('h','j','be')
 ,('i','d','bsc')
 ,('j','j','bsc')
 ,('k','d','be')

 select team,qualification,COUNT(qualification ) from #dev
 group by team,qualification having qualification = 'be'

 select team,qualification,COUNT(qualification ) from #dev
 where qualification = 'be'
 group by team,qualification

They return same result. Here, I have a doubt. that is:

which query is efficient..? which query is preferred by expert?

Answer will be very useful to us, in future.

Thanks, TamilPugal.

Pugal
  • 539
  • 5
  • 20
  • Possible duplicate of [What's the difference between HAVING and WHERE?](https://stackoverflow.com/questions/287474/whats-the-difference-between-having-and-where) – Andrea Jul 08 '18 at 07:58
  • @Andrea thx for effort.. I read that link. There, explain full of `different btw where and having`.. where as I another question that is, `which query is efficient?` – Pugal Jul 09 '18 at 07:06

0 Answers0