Geeks Talk

Prepare for your Next Interview


Welcome to the Geeks Talk forums.

You are currently viewing our boards as a guest which gives you limited access to view most discussions and access our other features. By joining our free community you will have access to post topics, communicate privately with other members (PM), respond to polls, upload content and access many other special features. Registration is fast, simple and absolutely free so please, join our community today!

If you have any problems with the registration process or your account login, please contact contact us.

Where Clause with Group by and Order by

This is a discussion on Where Clause with Group by and Order by within the MY SQL forums, part of the Databases category; Can we use Where clause with Group by Or Order By? If yes, Also can we use all three clause in a single query...

Go Back   Geeks Talk > Databases > MY SQL
Register Blogs FAQ Tag Cloud Calendar Mark Forums Read
  #1 (permalink)  
Old 08-08-2009
Junior Member
 
Join Date: Aug 2006
Location: delhi
Posts: 3
Thanks: 1
Thanked 0 Times in 0 Posts
GUPTASWORLD is on a distinguished road
Where Clause with Group by and Order by

Can we use Where clause with Group by Or Order By? If yes, Also can we use all three clause in a single query
Reply With Quote
Sponsored Links
  #2 (permalink)  
Old 08-09-2009
Moderator
 
Join Date: Jun 2007
Location: Bangalore,India
Posts: 1,853
Thanks: 9
Thanked 168 Times in 142 Posts
debasisdas has a spectacular aura aboutdebasisdas has a spectacular aura about
Re: Where Clause with Group by and Order by

Yes
Yes
you can also use having clause with the other three clauses.

sample code
Code:
SELECT product_type_id, AVG(price)
FROM products
WHERE price < 15
GROUP BY product_type_id
HAVING AVG(price) > 13
ORDER BY product_type_id;
Reply With Quote
The Following 2 Users Say Thank You to debasisdas For This Useful Post:
  #3 (permalink)  
Old 10-06-2009
Junior Member
 
Join Date: Aug 2006
Location: delhi
Posts: 3
Thanks: 1
Thanked 0 Times in 0 Posts
GUPTASWORLD is on a distinguished road
Re: Where Clause with Group by and Order by

thanks friend
Reply With Quote
Reply

  Geeks Talk > Databases > MY SQL

Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is On
Trackbacks are On
Pingbacks are On
Refbacks are Off


Similar Threads

Thread Thread Starter Forum Replies Last Post
Join two tables and apply group by clause Geek_Guest SQL 3 06-18-2009 02:53 PM
SQL Order By Clause rijus SQL 3 06-04-2009 04:10 AM
Group level data item in WHERE clause kulkarte DB2 3 04-04-2009 10:18 AM
Group by and order by jainbrijesh SQL Server 4 01-23-2008 12:22 AM
Output port and Group by clause in SQ JobHelper Data Warehousing 1 01-04-2007 12:17 PM


All times are GMT -4. The time now is 06:36 PM.


Powered by vBulletin® Version 3.8.4
Copyright ©2000 - 2009, Jelsoft Enterprises Ltd.
Content Relevant URLs by vBSEO 3.3.1
Copyright © 2009 GeekInterview.com. All Rights Reserved