SitePoint Sponsor

User Tag List

Results 1 to 7 of 7

Threaded View

  1. #1
    SitePoint Wizard
    Join Date
    Dec 2005
    Posts
    1,675
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)

    COUNT Causing Problems.

    Hi all

    What I have below works good and returns all the reviews depending on the venue_id selected.
    Code SQL:
    SELECT comments,
    	DATE_FORMAT(review_date, '%M %D %Y') AS subdir,
    	publisher, rating,  FROM tbl_reviews WHERE venue_id='"...

    Example return
    comments: some comments about the venue
    date: 12th dec 12
    rating: 4

    comments: some comments about the venue
    date: 13th dec 12
    rating: 2

    and so on...

    But now I need to COUNT the number of reviews for that particular venue_id.

    Code SQL:
    SELECT comments,
    	DATE_FORMAT(review_date, '%M %D %Y') AS subdir,
    	publisher, rating, COUNT(venue_id) AS VenueReviewTotal FROM tbl_reviews WHERE venue_id='"...

    Example return
    comments: some comments about the venue
    date: 12th dec 12
    rating: 4

    and stops, only shows one review even if there are 15

    The review count is correct
    VenueReviewTotal 15

    What is happening, why does this happen when I introduce the COUNT function?

    Thanks,
    Barry
    Last edited by computerbarry; Dec 5, 2012 at 11:51. Reason: spelling
    The more you learn.... the more you learn there is more to learn.


Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •