Results 1 to 4 of 4
  1. #1
    Join Date
    Aug 2006
    Location
    North Carolina
    Posts
    280
    Plugin Contributions
    0

    Default Need help with a mySQL Query

    Hey gang,

    I'd like to create the following mySQL query from the ZenCart tables, but I'm unable to figure it out.

    I want to find ALL products purchased under a specific customer number.

    I can get all invoices for a customer number
    and all products under an invoice
    but I'l like to skip the invoices and just show all the products sold under a specific customer number

    Any formulas would be appreciated

    thanks,
    Jeff Michaels,
    pres of Musical Creations Ltd.

  2. #2
    Join Date
    Jan 2004
    Posts
    66,443
    Plugin Contributions
    279

    Default Re: Need help with a mySQL Query

    Code:
    select * 
    from zen_orders_products 
    where orders_id in (
      select orders_id 
      from zen_orders 
      where customers_id = 1
    ) order by products_name, products_model;
    .

    Zen Cart - putting the dream of business ownership within reach of anyone!
    Donate to: DrByte directly or to the Zen Cart team as a whole

    Remember: Any code suggestions you see here are merely suggestions. You assume full responsibility for your use of any such suggestions, including any impact ANY alterations you make to your site may have on your PCI compliance.
    Furthermore, any advice you see here about PCI matters is merely an opinion, and should not be relied upon as "official". Official PCI information should be obtained from the PCI Security Council directly or from one of their authorized Assessors.

  3. #3
    Join Date
    Sep 2010
    Posts
    263
    Plugin Contributions
    0

    red flag Re: Need help with a mySQL Query

    Can you show me how to do such a query ? I would like to make a custom query in a php script.

  4. #4
    Join Date
    Mar 2009
    Posts
    609
    Plugin Contributions
    0

    Default Re: Need help with a mySQL Query

    Similar to what I'm trying to achieve I think...

    I want a page where a customer can at a glance see all products they have purchased.

 

 

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 query
    By clint6998 in forum General Questions
    Replies: 35
    Last Post: 15 Mar 2016, 02:39 PM
  3. v154 Quick help with MySQL Query - Selecting OLD Product at Random
    By Jeff_Mash in forum Setting Up Specials and SaleMaker
    Replies: 21
    Last Post: 24 Nov 2015, 12:05 AM

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