Results 1 to 2 of 2
  1. #1
    Join Date
    Jun 2006
    Posts
    35
    Plugin Contributions
    0

    help question sql query to output snail mail addresses?

    Need query to select orders by manufacturer id.
    and return a list of customer names and addresses who have made orders from the specified manufacturer.

    I've been trying to write an sql query to export a list of mailing addresses of customers who have purchased from specified manufacturers.

    I can paste the query into my database myself, I just cant come up with a query that works. Everything I do pulls ALL of the addresses not ones that bought from that manufacturer only.

    the effected tables and fields are: {I think}

    zen_address_book >
    customers_id
    entry_firstname
    entry_lastname
    entry_street_address
    entry_city
    entry_postcode


    zen_orders >
    customers_id
    orders_id

    zen_orders_products >
    orders_id
    products_id

    zen_products >
    products_id
    manufacturers_id


    any ideas???

  2. #2

    Default Re: sql query to output snail mail addresses?

    Code:
    select o.delivery_name, o.delivery_company, o.delivery_street_address, o.delivery_suburb, o.delivery_city, o.delivery_postcode, o.delivery_state, o.delivery_country
    from orders o JOIN orders_products op USING(orders_id) JOIN products p USING(products_id) JOIN manufacturers m USING(manufacturers_id)
    where m.manufacturers_id = id_of_your_manufacturer
    Or, if You want select manufacturer by its name:
    Code:
    select o.delivery_name, o.delivery_company, o.delivery_street_address, o.delivery_suburb, o.delivery_city, o.delivery_postcode, o.delivery_state, o.delivery_country
    from orders o JOIN orders_products op USING(orders_id) JOIN products p USING(products_id) JOIN manufacturers m USING(manufacturers_id)
    where m.manufacturers_name like 'name_of_manufacturer'

 

 

Similar Threads

  1. (Snail) Mail list?
    By Serious in forum General Questions
    Replies: 8
    Last Post: 6 Mar 2013, 12:13 AM
  2. Need Snail Mail List
    By tat2nu in forum Managing Customers and Orders
    Replies: 2
    Last Post: 15 Feb 2010, 01:55 AM
  3. downloads and snail mail
    By Didee in forum Setting Up Categories, Products, Attributes
    Replies: 12
    Last Post: 14 Feb 2009, 07:12 AM
  4. Creating a Snail Mail List
    By cherish in forum General Questions
    Replies: 1
    Last Post: 17 Oct 2006, 11:48 PM

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