Page 2 of 3 FirstFirst 123 LastLast
Results 11 to 20 of 22
  1. #11
    Join Date
    Aug 2007
    Location
    Tampa
    Posts
    15
    Plugin Contributions
    0

    Default Re: Help with a sql query

    I also have tried the Admin DOWNLOAD Export Shipping Info 1.2.2 to CSV and it works great except it places ALL of the Attributes for each product ordered into a single field that I cannot break out.

  2. #12
    Join Date
    Jul 2004
    Location
    Las Vegas
    Posts
    477
    Plugin Contributions
    0

    Default Re: Help with a sql query

    I just came up with a simpler solution. I will import all of my products and descriptions to my new zencart install and then simply run a sql query that deletes all products not associate with master_category _id 69 and it decriptions.

    So now all I need help with is writing the delete command excluding the Master_Category_Id = 69 and associated descriptions.

    thank you for help in advanced
    User of zencart

  3. #13
    Join Date
    Jan 2004
    Posts
    66,450
    Plugin Contributions
    81

    Default Re: Help with a sql query

    Why are you doing all this ?
    .
    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.

  4. #14
    Join Date
    Jul 2004
    Location
    Las Vegas
    Posts
    477
    Plugin Contributions
    0

    Default Re: Help with a sql query

    because I have a huge site with so many products of some many unrelated products, batteries

    So I am developing small specialized sites focused on a particular group of products ie..

    Photographic Batteries -> www.photographicbattery.com
    Photo Lithium Batteries -> www.photolithium.com
    Hotel Door Lock Batteries -> www.hoteldoorlocks.com

    and so on. I have like 10 sites total that I will be developing. They will all be linked back to my main site and then in each site I will be implementing blogs and feeds in each site to creative a network of information and support. So I need to easily extract the groups of products for each site and re upload them into the new databases.
    User of zencart

  5. #15
    Join Date
    Jul 2004
    Location
    Las Vegas
    Posts
    477
    Plugin Contributions
    0

    Default Re: Help with a sql query

    I figured it out... this is what I did

    first i exported the database info that I needed for the new database..

    1. categories
    2. categories_descriptions
    3. products
    4. products_descriptions
    5. products_to_categories

    There are more I should have included but I didnt because I was testing my process.

    second I uploaded them into my new database

    third I ran this sql query to delete the descriptions of the products I didnt want, which you must do first because the query compares description to product based on the master_id in the product table
    delete pd.* from zen_products p, zen_products_description pd where p.products_id = pd.products_id and p.master_categories_id != 69
    fouth, now you can delete the product
    delete from zen_products where master_categories_id != 69
    fifth, you must now go thru and delete all other information relating to the categories and old products that are no longer there

    deletes products that went to categories no longer there
    delete from zen_products_to_categories where categories_id != 69
    deletes the categories no longer there
    delete from zen_categories where categories_id != 69
    Im sure theres more like if you have special pricing for a product (products_discount_quantity) upload it and then delete out the unnecessary info and so on..

    thank you dr. byte for the lesson
    Last edited by batteryman; 7 Sep 2007 at 12:30 AM. Reason: because I made stupid errors
    User of zencart

  6. #16
    Join Date
    Jan 2004
    Posts
    66,450
    Plugin Contributions
    81

    Default Re: Help with a sql query

    Sounds like you've got it.

    Step 4 was redundant due to step 3.

    You might also consider the products_options_* tables and products_attributes_* tables if you have attributes on those products. And, you mentioned the quantity discounts already.


    Table reference: http://www.zen-cart.com/wiki/index.p...a#Product_Info
    .
    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.

  7. #17
    Join Date
    Jul 2004
    Location
    Las Vegas
    Posts
    477
    Plugin Contributions
    0

    Default Re: Help with a sql query

    thank you dr. byte for your suggestion and the link. That will be very helpful for future development.

    avel
    User of zencart

  8. #18
    Join Date
    Jul 2004
    Location
    Las Vegas
    Posts
    477
    Plugin Contributions
    0

    Default Re: Help with a sql query

    delete pd.* from zen_products p, zen_products_description pd where p.products_id = pd.products_id and p.master_categories_id != 69
    I want to use this mysql to delete products from my database but I need to delete all excepts a few categories. How would I accomplish that?

    The categories I want to keep are 91, 92, 93, 94, 95, 96, 97, 298

    Thank you
    avel
    User of zencart

  9. #19
    Join Date
    Jul 2004
    Location
    Las Vegas
    Posts
    477
    Plugin Contributions
    0

    Default Re: Help with a sql query

    Hello, I would like to remove all the zen_ prefixes from my new site database that I just imported over to a new store I am working on. I know how to do it on a 1 by 1 basis but I would like to do it for all 95 tables at once


    this is the 1 by 1 method
    RENAME TABLE zen_address_book TO address_book
    what is the all table rename method??
    Insert Here!! LOL
    Thank you in advanced
    User of zencart

  10. #20
    Join Date
    Jan 2004
    Posts
    66,450
    Plugin Contributions
    81

    Default Re: Help with a sql query

    Quote Originally Posted by batteryman View Post
    Hello, I would like to remove all the zen_ prefixes from my new site database that I just imported over to a new store I am working on. I know how to do it on a 1 by 1 basis but I would like to do it for all 95 tables at once


    this is the 1 by 1 method
    what is the all table rename method??
    You might try it on a test site ... but ... if you use the zc_install tool, click into database-upgrade mode, ignore all the checkboxes and scroll down further: you'll see input fields near the bottom of that upgrade page, which can be used to do the bulk rename.
    .
    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.

 

 
Page 2 of 3 FirstFirst 123 LastLast

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. Need help with SQL query. Want to make membership that expires.
    By TecBrat in forum Managing Customers and Orders
    Replies: 1
    Last Post: 18 Jun 2010, 03:43 PM
  4. Help with SQL query
    By Danielle in forum General Questions
    Replies: 3
    Last Post: 9 Jun 2008, 05:24 AM
  5. Help with SQL query returning multiple rows
    By acetate in forum General Questions
    Replies: 3
    Last Post: 9 Mar 2008, 03:23 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