Home » SQL & PL/SQL » SQL & PL/SQL » can we use column alias in having clause
can we use column alias in having clause [message #660733] Sun, 26 February 2017 01:08 Go to next message
asliyanage
Messages: 60
Registered: January 2017
Member
I need to know can we us column alias in having clause ?
I already know we can use it in order by clause.
Re: can we use column alias in having clause [message #660734 is a reply to message #660733] Sun, 26 February 2017 01:10 Go to previous messageGo to next message
John Watson
Messages: 7669
Registered: January 2010
Location: Global Village
Senior Member
You need to work on your problem solving skills, man! In this case, just try it.
Re: can we use column alias in having clause [message #660735 is a reply to message #660734] Sun, 26 February 2017 01:12 Go to previous messageGo to next message
asliyanage
Messages: 60
Registered: January 2017
Member
i tried, its not working.IT says column alias can't use in group by clause. But it didn't say that we can't use them it in having clause ?
Re: can we use column alias in having clause [message #660736 is a reply to message #660735] Sun, 26 February 2017 01:12 Go to previous messageGo to next message
John Watson
Messages: 7669
Registered: January 2010
Location: Global Village
Senior Member
This is hopeless.
Re: can we use column alias in having clause [message #660742 is a reply to message #660733] Sun, 26 February 2017 01:41 Go to previous messageGo to next message
Michel Cadot
Messages: 65970
Registered: March 2007
Location: Nanterre, France, http://...
Senior Member
Account Moderator

Once again Database SQL Reference, maybe you should read it.

Re: can we use column alias in having clause [message #660751 is a reply to message #660735] Sun, 26 February 2017 04:55 Go to previous messageGo to next message
Solomon Yakobson
Messages: 2812
Registered: January 2010
Location: Connecticut, USA
Senior Member
asliyanage wrote on Sun, 26 February 2017 02:12
i tried, its not working.IT says column alias can't use in group by clause. But it didn't say that we can't use them it in having clause ?
Alias can be referenced by parent query only.

SY.
Re: can we use column alias in having clause [message #660823 is a reply to message #660751] Mon, 27 February 2017 09:14 Go to previous message
Bill B
Messages: 1814
Registered: December 2004
Senior Member
What is the problem with not using the alias.

select owner,count(*) obj_cnt
from dba_objects
group by owned
having count(*) > 100;

easy
Previous Topic: Deletes with respect to table sizes
Next Topic: Avoiding 2 Group By clauses
Goto Forum:
  


Current Time: Sat Nov 17 08:57:55 CST 2018