Thread: query help

Results 1 to 2 of 2
  1. #1
    Join Date
    Mar 2011
    Posts
    52
    Plugin Contributions
    0

    Default query help

    I am trying to add average rating to my category page. I took a look at the query and it seems like it should be doable.

    I wrote the query but it errors out. Any help would be much appreciated.

    SELECT p.products_id, p.products_type, pd.products_name, p.products_image, p.products_price,
    p.products_tax_class_id, p.products_date_added, p.products_model,
    p.products_quantity, p.products_weight, p.product_is_call,
    p.product_is_always_free_shipping, p.products_qty_box_status,
    avg(r.reviews_rating) as average_rating, p.master_categories_id
    FROM " . TABLE_PRODUCTS . " p," . TABLE_PRODUCTS_DESCRIPTION . " pd
    LEFT JOIN " . TABLE_REVIEWS . " r
    ON (p.products_id = r.reviews_id),
    WHERE p.products_status = 1
    AND p.products_id = pd.products_id
    AND pd.language_id = :languageID
    AND p.master_categories_id in (".$sub_cat_list.")". $order_by

  2. #2
    Join Date
    Jan 2007
    Location
    Australia
    Posts
    6,167
    Plugin Contributions
    7

    Default Re: query help

    Quote Originally Posted by geeker View Post
    I wrote the query but it errors out. Any help would be much appreciated.
    It may help if you could let us know what the error message is saying.

    Cheers
    Rod

 

 

Similar Threads

  1. Replies: 9
    Last Post: 12 Jul 2023, 12:26 AM
  2. v154 Help with a SQL Query for Query Builder
    By lindasdd in forum Managing Customers and Orders
    Replies: 2
    Last Post: 24 Mar 2016, 01:18 PM
  3. v151 SQL query setup. How do I TEST a query 'off-line'?
    By lewisasding in forum General Questions
    Replies: 3
    Last Post: 8 Mar 2013, 12:24 AM
  4. SQL query help
    By petek in forum General Questions
    Replies: 6
    Last Post: 23 May 2010, 10:57 AM
  5. help!!!! header help and hosting query urgent!
    By personalisedpresent in forum Templates, Stylesheets, Page Layout
    Replies: 13
    Last Post: 26 Sep 2006, 11:42 AM

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
  •  
disjunctive-egg
Zen-Cart, Internet Selling Services, Klamath Falls, OR