MySQL Forums
Forum List  »  Newbie

Re: need help creating a mysql 5.0.95 query
Posted by: jae ahn
Date: April 04, 2012 12:51PM

i guess the example i tried to make in the original post isn't enough. hopefully i can make it less complicated. i'll do my best to explain.

i can only search under 2 things in the table
products_to_categories
which are... products_id and categories_id

what i want to do is be able to search the products_name or even products_description for a particular word or part of the name. but this can only be done under the table
products_description

after that, i want to be able to change the current categories_id to a different categories_id which i will set. essentially it's like moving them to a different folder.

but the problem is that the only data the 2 tables share is products_id


let's say there are some products with similar names. The names are AAA01 AAA02 AAA03. so there are 3 products in this case. they are all currently in the same category. the category number is 9999. each of these products have a unique product_id

this is the information i have to work with.
products_name , categories_id , products_id

AAA01 9999 0001
AAA02 9999 0002
AAA03 9999 0003
---------------------
under the table products_description, i have the products_name and products_id

AAA01 0001
AAA02 0002
AAA03 0003
---------------------
under the table products_to_categories, i have products_id and cateogires_id

0001 9999
0002 9999
0003 9999
----------------------

i want to move them to a different category called 1111. so i need to set the category for those specific products to 1111

so in the end i get this

products_name , categories_id , products_id

AAA01 1111 0001
AAA02 1111 0002
AAA03 1111 0003
--------------------

so i'm thinking i would need to search for all products_name that begin with AAA, then i'll get all 3 products in my search.

then i need it to find the matching products_id in the table products_to_categories, and set the categories_id of those products to 1111.


i hope this was good enough.

Options: ReplyQuote


Subject
Written By
Posted
Re: need help creating a mysql 5.0.95 query
April 04, 2012 12:51PM


Sorry, you can't reply to this topic. It has been closed.

Content reproduced on this site is the property of the respective copyright holders. It is not reviewed in advance by Oracle and does not necessarily represent the opinion of Oracle or any other party.