If this is your first visit, be sure to check out the FAQ by clicking the link above. You may have to register before you can post: click the register link above to proceed. To start viewing messages, select the forum that you want to visit from the selection below.

 
Go Back  dBforums > Database Server Software > MySQL > Query Statement Help

Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1 (permalink)  
Old 11-09-04, 15:30
dalmuti dalmuti is offline
Registered User
 
Join Date: Nov 2004
Posts: 2
Query Statement Help

I am using a shopping cart and have entered over 700 products and now find out that I am missing one important field and rather than go through the frontend I would like to run a SQL statement to make add the info.

I have 2 tables...

Products
Product_Taxes

The common field is productid......

There are only 2 fields in Product_Taxes - productid and taxid.
I updated 3 products manually through the frontend so I only have 3 entries in the Product_Taxes table.

What I think I need to do is be able to join the two tables using productid and enter taxid from an update statement.....but I am not sure how to do it.

Can anyone help me with this?

Thanks,

Dalmuti
Reply With Quote
  #2 (permalink)  
Old 11-10-04, 08:08
guelphdad guelphdad is offline
Registered User
 
Join Date: Mar 2004
Posts: 440
What version of mysql are you using?
Reply With Quote
  #3 (permalink)  
Old 11-10-04, 10:50
dalmuti dalmuti is offline
Registered User
 
Join Date: Nov 2004
Posts: 2
Hi,

I am using MySQL 4.0.18. Appreciate any help you can offer.

Thanks,

Dalmuti
Reply With Quote
  #4 (permalink)  
Old 11-10-04, 13:44
guelphdad guelphdad is offline
Registered User
 
Join Date: Mar 2004
Posts: 440
You need 4.0.4 or newer (which you have) to do multi table updates which is why i asked.

you can just do something like:

Code:
UPDATE products, product_taxes
SET taxid = ???
WHERE products.productid = product_taxes.productid
where you would set out the proper info for the taxid if I'm understanding your question correctly.
Reply With Quote
Reply

Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On