Thread: SQL Syntax Help

Results 1 to 9 of 9
  1. #1
    Join Date
    Feb 2012
    Posts
    78
    Plugin Contributions
    0

    Default SQL Syntax Help

    I would like to set the values of all items in master category 1 for metatags_model_status to all = 0

    I have some other values I want changed as well. But this information should get me started.

    I tried some variations of the below syntax without success
    SELECT * FROM `znc_products` WHERE `master_categories_id` = 1
    SET metatags_model_status = replace(metatags_model_status,'1','0');

    Further to this, I would like to update all the meta keywords and such for all items in master category 1

    Yes, I have backed up my DB

  2. #2
    Join Date
    Jan 2012
    Posts
    488
    Plugin Contributions
    0

    Default Re: SQL Syntax Help

    Should be something like:

    UPDATE products
    SET metatags_model_status = 0
    WHERE `master_categories_id` = 1

  3. #3
    Join Date
    Feb 2012
    Posts
    78
    Plugin Contributions
    0

    Default Re: SQL Syntax Help

    this worked using

    UPDATE znc_products
    SET metatags_title_tagline_status = 0
    WHERE `master_categories_id` = 1

    THX...

    One more thing. How would I change the meta keywords, description for all those in that master category? I am not able to find a way to connected the 2 tables with the product meta information with the products to category table

    I guess something like
    SELECT * FROM `znc_meta_tags_products_description` , `znc_products` WHERE `master_categories_id` = 1
    Last edited by MHulak; 20 Aug 2012 at 03:04 AM. Reason: more info added

  4. #4
    Join Date
    Jan 2012
    Posts
    488
    Plugin Contributions
    0

    Default Re: SQL Syntax Help

    I think you are looking for a join to return the data you need.


    Sorry, I'm more of a hack with SQL than anything.

  5. #5
    Join Date
    Feb 2012
    Posts
    78
    Plugin Contributions
    0

    Default Re: SQL Syntax Help

    BUMP>>

    I am unable to figure out how to update the title, meta keyword and meta description for all the items in a specific category.

    Can someone show me how to change that information only for a specific category?

  6. #6
    Join Date
    Feb 2012
    Posts
    78
    Plugin Contributions
    0

    Default Re: SQL Syntax Help

    i see products are linked using a specific table

    SELECT *
    FROM `znc_products_to_categories`
    WHERE 1
    LIMIT 0 , 30


    if i want to call up the meta information for all products i use the following

    SELECT *
    FROM `znc_meta_tags_products_description`
    WHERE 1
    LIMIT 0 , 30

    i need help on syntax to select the meta_tag_ information for all products in a specific category

    tyia

  7. #7
    Join Date
    Jan 2012
    Posts
    488
    Plugin Contributions
    0

    Default Re: SQL Syntax Help

    Adjust for your db/table names:



    Select *
    From products_to_categories Inner Join
    meta_tags_products_description On meta_tags_products_description.products_id =
    products_to_categories.products_id
    WHERE 1
    LIMIT 0, 30

  8. #8
    Join Date
    Aug 2007
    Location
    Gijón, Asturias, Spain
    Posts
    2,591
    Plugin Contributions
    30

    Default Re: SQL Syntax Help

    why don't you just export the products and the field you want to change using Apsona to a CSV, edit it and import it back, no need to risk sql mistakes?
    Steve
    github.com/torvista: Spanish Language Pack, Google reCaptcha, Structured Data, Multiple Copy-Move-Delete, Image Checker, BackupMySQL Admin/Auto...

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

    Default Re: SQL Syntax Help

    Quote Originally Posted by torvista View Post
    why don't you just export the products and the field you want to change using Apsona to a CSV, edit it and import it back, no need to risk sql mistakes?
    Speed!

    A few minutes spent learning how to achieve a bulk change using SQL can save many hours of export/edit/import, which also has its own risk of mistakes. The important thing is avoid doing the learning on 'live' data. Make a copy first.

    Cheers
    Rod

 

 

Similar Threads

  1. Replies: 1
    Last Post: 25 Aug 2011, 05:58 AM
  2. HELP... 1064 You have an error in your SQL syntax;
    By limelites in forum General Questions
    Replies: 11
    Last Post: 16 Oct 2009, 05:31 PM
  3. sql syntax error 1064 - HELP NEEDED - Master Password
    By mydesignerstudio in forum All Other Contributions/Addons
    Replies: 2
    Last Post: 20 Jul 2009, 04:22 PM
  4. SQL Syntax error: check for right syntax to use near '000000
    By gabyone in forum General Questions
    Replies: 2
    Last Post: 9 Feb 2008, 08:23 PM
  5. 1064 SQL syntax Error - Max Value Changed ...HELP!!
    By Canvas101 in forum Setting Up Categories, Products, Attributes
    Replies: 3
    Last Post: 7 Oct 2007, 01:14 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