GeekInterview.com
   Home |  Tech FAQ  |   Interview Questions |  Placement Papers |  Tech Articles |  Learn |  Freelance Projects |  Online Testing |  Geeks Talk |  Job Postings |  Knowledge Base | Site Search |  Add/Ask Question

GeekInterview.com  >  Interview Questions  >  Mainframe  >  DB2
Go To First  |  Previous Question  |  Next Question 
 DB2  |  Question 114 of 196    Print  
Can GROUP BY and ORDERED BY used in a single query?

  
Total Answers and Comments: 7 Last Update: November 14, 2006     Asked by: Alok.Ray 
  
 Sponsored Links

 
 Best Rated Answer

No best answer available. Please pick the good answer available or submit your answer.
December 24, 2005 15:32:42   #1  
suresh        

RE: Can GROUP BY and ORDERED BY used in a single query...

You can use GROUP BY and ORDER BY in the same query.

Interview Questions

http://www.geocities.com/srcsinc/Questions.html


 
Is this answer useful? Yes | No
December 30, 2005 12:10:19   #2  
Vinod Maanju        

RE: Can GROUP BY and ORDERED BY used in a single query...
YES we can use and Group by must come in order to code query.Ex. select * from tab01 group by col1 order by col02
 
Is this answer useful? Yes | No
January 31, 2006 04:41:37   #3  
sai        

RE: Can GROUP BY and ORDERED BY used in a single query...
We can use Group By and order by in a single query only if both of them(Group by and order by)  use the same column.
 
Is this answer useful? Yes | No
March 18, 2006 19:20:17   #4  
Culver_lake Member Since: March 2006   Contribution: 46    

RE: Can GROUP BY and ORDERED BY used in a single query...

GROUP  BY and ORDER BY can be used in the same query and it is NOT required that they be the same column.  GROUP BY controls the way the data is organized for sumarization.  ORDER BY simply sorts the rows of the result.  The following is legal:

SELECT  DEPARTMENT, AVG(SALARY) AS AVG

FROM     EMPLOYEE

GROUP BY DEPARTMENT

ORDER BY AVG


 
Is this answer useful? Yes | No
April 04, 2006 07:02:33   #5  
dip62001 Member Since: April 2006   Contribution: 1    

RE: Can GROUP BY and ORDERED BY used in a single query...
Yes
 
Is this answer useful? Yes | No
June 22, 2006 07:47:54   #6  
Mahesh        

RE: Can GROUP BY and ORDERED BY used in a single query...

Group by controls the presentation of the rows, 

Order by controls the presentation of the columns  for the results of the SELECT statement


 
Is this answer useful? Yes | No
November 14, 2006 13:12:42   #7  
sekhu_da Member Since: November 2006   Contribution: 14    

RE: Can GROUP BY and ORDERED BY used in a single query...

group :- is used to find the sum

and orderby is like checking the condition .

furter explansion will be provided upon req!


 
Is this answer useful? Yes | No


 
Go To Top


 Sponsored Links

 
Sponsored Links

 




About Us  |   Privacy Policy  |   Terms and Conditions  |   Contact  |   Site Map  |   Add Question  |   Propose Category  |   RSS Feeds  |   Articles Sitemap  |   Site Updates  |   Add Resource

Copyright © 2005 - 2008 GeekInterview.com. All Rights Reserved
Page copy protected against web site content infringement by Copyscape