Home » SQL & PL/SQL » SQL & PL/SQL » SQL query
SQL query [message #276354] Wed, 24 October 2007 23:42 Go to next message
Roopanwita
Messages: 1
Registered: October 2007
Location: India
Junior Member
Hi,
My question is ,can we have ORDERBY,GROPUPBY,HAVING and WHERE clause in same SQL query.
If yes please send my syntax of query.
Thanks
Re: SQL query [message #276361 is a reply to message #276354] Thu, 25 October 2007 00:06 Go to previous messageGo to next message
Frank
Messages: 7880
Registered: March 2000
Senior Member
First you try.
Show what you do, show what happens.
If you are stuck then, we will help out.

Hint: The answer is that IS possible.
Re: SQL query [message #276367 is a reply to message #276354] Thu, 25 October 2007 00:42 Go to previous messageGo to next message
Michel Cadot
Messages: 64102
Registered: March 2007
Location: Nanterre, France, http://...
Senior Member
Account Moderator
SELECT

Regards
Michel
Re: SQL query [message #276377 is a reply to message #276354] Thu, 25 October 2007 01:13 Go to previous messageGo to next message
Littlefoot
Messages: 20888
Registered: June 2005
Location: Croatia, Europe
Senior Member
Account Moderator
Among many possible ways, this is one of them:
select 'ORDERBY,GROPUPBY,HAVING and WHERE' result from dual;
Re: SQL query [message #276433 is a reply to message #276377] Thu, 25 October 2007 02:50 Go to previous messageGo to next message
pablolee
Messages: 2834
Registered: May 2007
Location: Scotland
Senior Member
Laughing
Re: SQL query [message #276596 is a reply to message #276354] Thu, 25 October 2007 10:30 Go to previous messageGo to next message
Kanagaraj Velusamy
Messages: 12
Registered: October 2005
Location: Bangalore
Junior Member

Hi Littlefoot

Very good answer. Laughing Laughing


Roopanwita,
select empno,sum(salary) from emp
group by empno having sum(salary) > 1000 order by empno

Cheers
Kanagaraj


Re: SQL query [message #276633 is a reply to message #276596] Thu, 25 October 2007 12:20 Go to previous message
Littlefoot
Messages: 20888
Registered: June 2005
Location: Croatia, Europe
Senior Member
Account Moderator
You don't have a WHERE clause.

Although it seems funny, I just wanted to emphasize the fact that the original poster doesn't care much about proper spelling. We are human beings and we understand that he meant to say 'ORDER BY' instead of 'ORDERBY' and 'GROUP BY' instead of 'GROPUPBY' (!!!) But Oracle wouldn't be that generous. I just hope he followed the link Michel suggested and learnt basic syntax of the SELECT statement. I believe there's no excuse not to know how to write a simple SELECT (which we are, actually, talking about).
Previous Topic: TRANSLATE and REPLACE
Next Topic: how to delete data
Goto Forum:
  


Current Time: Fri Dec 02 23:21:20 CST 2016

Total time taken to generate the page: 0.08668 seconds