This is a discussion on Getting count of items with more than x reviews within the MySQL Database forums, part of the Database Forums category; For some reason I am having such an issue coming up with a query to tell me the total number ...
|
|||||||
| FAQ | Members List | Calendar | Search | Today's Posts | Mark Forums Read |
|
|||
|
For some reason I am having such an issue coming up with a query to
tell me the total number of items in one table that have more than X numbers of reviews 2 Tables Items & Reviews they both have item_id column (as index) Reviews table has an account_id and review_text column Can someone help me |
|
|||
|
On Fri, 16 Nov 2007 20:18:49 +0100, Ehask <ehask71@gmail.com> wrote:
> For some reason I am having such an issue coming up with a query to > tell me the total number of items in one table that have more than X > numbers of reviews > > 2 Tables > > Items & Reviews they both have item_id column (as index) Reviews > table has an account_id and review_text column SELECT i.item_id, COUNT(r.item_id) as number_of_reviews FROM items i JOIN reviews r ON r.item_id = i.item_id GROUP BY i.item_id HAVING number_of_reviews > X -- Rik Wasmus |