Do you have a question? Post it now! No Registration Necessary. Now with pictures!
- Posted on
- What Is Wrong With This query?
March 9, 2006, 6:17 pm
rate this thread
SET garment_details.blankprice = '1.50'
Inner Join colors ON garment_details.ColorID =
colors.ColorType = '1' AND
garment_details.GarmentID = 'fol3930r'
Re: What Is Wrong With This query?
It would be helpful when posting question if you would include details about
your environment and the symptoms of any error.
For instance, is this query causing an error? What is the error?
Or does it function correctly, but too slowly?
Or do you just want to know if it's good SQL coding style?
My guess is that you're using MySQL 4.0 or earlier, which doesn't support
subqueries. If so, you're getting a syntax error near where the "(Select"
If you're using at least 4.0.4, you can try this instead:
UPDATE garment_details g INNER JOIN colors c ON g.ColorID = c.ColorID
SET g.blankprice = '1.50'
WHERE g.GarmentDetailID = 'fol3930r' AND c.ColorType = '1';
This uses multi-table update syntax, which is an extension to SQL that MySQL
offers. It isn't standard SQL, but it's very useful.
- » Americanas.com SALDO de TVs Com at 80% de Desconto (29798)
- — Newest thread in » MySQL Database Forum
- » ssh on command line: force using a group size (prime size) of 1024 (and no...
- — The site's Newest Thread. Posted in » Secure Shell Forum