Thread: SQL help please

Results 1 to 3 of 3
  1. #1
    Join Date
    Oct 2007
    Posts
    132
    Plugin Contributions
    0

    Default SQL help please

    I'm trying to write a sql script to update the categories images.

    The database that will write the script has the image name and the category name but not the category ID.

    My problem is that the names are in one table but the images in another.

    I tried...
    update 'zen_categories_description`,`zen_categories` set zen_categories.categories_image = 'test2.jpg' where zen_categories_description.categories_name = "Fittings"
    but this updated every category.

    There will be over a hundred of these, so manual entry is not realistic.

    Any help is appreciated.
    Jeff

  2. #2
    Join Date
    Sep 2004
    Location
    Western Massachusetts
    Posts
    2,945
    Plugin Contributions
    5

    Default Re: SQL help please

    you need to add an extra condition there to link the two tables:
    Code:
    update 'zen_categories` set zen_categories.categories_image = 'test2.jpg' where zen_categories_description.categories_name = "Fittings" and zen_categories.categories_id = zen_categories_description.categories_id
    Neville
    An assumption is what you arrive at when you get tired of thinking...

  3. #3
    Join Date
    Oct 2007
    Posts
    132
    Plugin Contributions
    0

    Default Re: SQL help please

    Thanks! It does exactly what I need.

 

 

Similar Threads

  1. v150 SQL Error Please help!
    By manu_sag in forum General Questions
    Replies: 1
    Last Post: 1 Apr 2012, 09:48 AM
  2. v139h SQL question... help please!
    By Feznizzle in forum General Questions
    Replies: 4
    Last Post: 3 Mar 2012, 10:31 PM
  3. SQL Error Help Please
    By jmp04 in forum General Questions
    Replies: 5
    Last Post: 30 Jan 2011, 07:20 PM
  4. Sql help please
    By jewelrylady in forum General Questions
    Replies: 4
    Last Post: 30 Jan 2007, 07:13 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