Jump to content

Recommended Posts

Sorry about that.  I'll try to be clearer.  I don't think those examples touched this.  Here is what I want to do.  I know it does not work and probably involves a subquery, but hopefully this will make the issue clear at least.

 

A real world example.  Let's say I wanted to group books by author.  However, I only wanted to see the authors that have written at least ten books. 

 

SELECT *, COUNT(book_ID) FROM table WHERE COUNT(book_ID)>10 GROUP BY author_ID

 

Of course, I can limit the result to 15 or 20 authors, but I cannot figure out how to limit the result to those authors who have only written x books or more.

 

It depends if you got all the info in one table or not. A subquery maybe necessary if dealing with multiple tables.

 

The last query example using "HAVING" will do it for you:

 

http://www.phpfreaks.com/forums/index.php/topic,179091.msg797633.html#msg797633  (same one as posted above)

 

 

 

 

This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.