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 > MySQL Problem

Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1 (permalink)  
Old 08-17-04, 19:48
mattmcb mattmcb is offline
Registered User
 
Join Date: Aug 2004
Posts: 4
MySQL Problem

Can someone tell me the correct syntax for this query:

Code:
UPDATE products SET products.cat = cat2.cat_desc WHERE cat2.id = products.cat
Reply With Quote
  #2 (permalink)  
Old 08-17-04, 19:56
yellowmarker yellowmarker is offline
Registered User
 
Join Date: Jul 2004
Location: Dundee, Scotland
Posts: 107
your syntax would work if you weren't trying to reference the cat2 table... i.e. with that syntax you can just reference fields in the products table using the WHERE clause.

try:
UPDATE `products`,`cat2`
SET products.cat=cat2.cat_desc
WHERE cat2.id = products.cat

http://dev.mysql.com/doc/mysql/en/UPDATE.html
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