Results 1 to 5 of 5
  1. #1
    Join Date
    May 2007
    Posts
    139

    Unanswered: I want get category name and no of products inside each of...

    is this query correct
    Code:
    SELECT Products.count(*), Categories.Category FROM Products GROUP BY Category_ID INNER JOIN Categories ON Categories.Category_ID = Products.Category_ID
    count(*) of products === number of products in each Category
    I want get category name and no of products inside each of...

  2. #2
    Join Date
    Apr 2002
    Location
    Toronto, Canada
    Posts
    20,002
    Quote Originally Posted by lse123 View Post
    is this query correct
    what happened when you tested it?
    rudy.ca | @rudydotca
    Buy my SitePoint book: Simply SQL

  3. #3
    Join Date
    May 2007
    Posts
    139
    null ... error pupulate arrays...js population ..I want to populate php arrays and there after javascript arrays with the two fields...

  4. #4
    Join Date
    Apr 2002
    Location
    Toronto, Canada
    Posts
    20,002
    Quote Originally Posted by lse123 View Post
    null ...
    here's a hint: the query contains a syntax error, and running the query outside of php, directly in the mysql engine, will produce an appropriate error message which will help you fnd the source of the problem

    that's what i meant by testing it

    you want to test the query itself, and not the application logic to build an array or whatever
    rudy.ca | @rudydotca
    Buy my SitePoint book: Simply SQL

  5. #5
    Join Date
    Nov 2004
    Location
    out on a limb
    Posts
    13,692
    Provided Answers: 59
    mind you you should have got soe sort of error message from the PHP/MYSQL interface
    did you examine the MySQL_Err & MySQLErrNo?
    Google
    I'd rather be riding on the Tiger 800 or the Norton

Posting Permissions

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