Results 1 to 3 of 3
  1. #1
    Join Date
    Mar 2006
    Location
    Florence, Italy
    Posts
    153
    Plugin Contributions
    0

    Default Help for mysql query!!

    I'm trying to solve the problem showed at
    http://www.zen-cart.com/forum/showthread.php?t=131048
    but I need help with mysql:

    I must work with two tables, (TABLE_PRODUCTS_WITH_ATTRIBUTES_STOCK and TABLE_PRODUCTS) and in both I want select records with the condition
    where quantity <='" . $stock_reorder_level . "'

    The two tables are related by the field `products_id` and I want retrieve all the records of the first table, and the records of the second table who's `products_id` IS NOT PRESENT in the first, and finally order with "order by products_id".

    Can anybody help me? Thanks - Giovanni

    p.s. - when solved this problem I'll post the complete solution.

  2. #2
    Join Date
    Aug 2005
    Location
    Arizona
    Posts
    27,755
    Plugin Contributions
    9

    Default Re: Help for mysql query!!

    First
    admin > config > stock > Stock Re-order level > set to your value

    Next
    admin > reports > Product Low Stock
    Zen-Venom Get Bitten

  3. #3
    Join Date
    Mar 2006
    Location
    Florence, Italy
    Posts
    153
    Plugin Contributions
    0

    Default Re: Help for mysql query!!

    That's the solution I've found:

    $products_query_raw = "select * from " .
    TABLE_PRODUCTS . " as a " .
    " left join " . TABLE_PRODUCTS_WITH_ATTRIBUTES_STOCK .
    " as b using (products_id) where
    b.quantity <='" . $stock_reorder_level . "' or
    a.products_quantity <='" . $stock_reorder_level . "'
    order by a.products_id, b.products_id, b.stock_id";

    The complete solution is at the link above.

    Giovanni

 

 

Similar Threads

  1. v155 Help with a MySQL query
    By lat9 in forum General Questions
    Replies: 7
    Last Post: 26 Apr 2016, 10:11 PM
  2. Need help with a mySQL Query
    By jeffmic in forum General Questions
    Replies: 3
    Last Post: 19 Dec 2010, 02:21 PM
  3. mysql query for order details?
    By billt in forum General Questions
    Replies: 0
    Last Post: 12 Oct 2009, 09:28 PM
  4. Report Query MySQL - Help Needed
    By ksoup in forum General Questions
    Replies: 2
    Last Post: 1 Jul 2008, 03:45 PM

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