Hi,

I'm wondering if the following can be done....

UPDATE tbe_gallery
SET tbe_gsa.gsa_paperprice = tbe_gallery.gallery_gsaprice_paper
WHERE tbe_gallery.gallery_id = tbe_images.img_rel_id AND
      tbe_images.img_orig_filename = tbe_gsa.gsa_id

Let me explain:

I have 3 tables and only 1 of them has the correct data which I need to update the other two.

The SQL statement above is based upon the following select statement below:

++++++++++++

SELECT tbe_gsa.gsa_id, tbe_gallery.gallery_id, tbe_gallery.gallery_title, tbe_gallery.gallery_price,
        tbe_gsa.gsa_sin, tbe_gsa.gsa_paperprice, tbe_gsa.gsa_canvasprice
FROM tbe_gsa INNER JOIN tbe_images ON tbe_gsa.gsa_id = tbe_images.img_orig_filename INNER JOIN tbe_gallery ON tbe_images.img_rel_id = tbe_gallery.gallery_id
ORDER BY gsa_id ASC

++++++++++++

This statement works just fine. However the table tbe_gsa contains the necessary column tbe_gsa.gsa_paperprice which has a match field of gsa_id, which matches a field in the images table called tbe_images.img_orig_filename, and the images table contains a match field called tbe_images.img_rel_id, which matches a field in the gallery table called tbe_galery.gallery_id.

So my question is how do use the corresponding match fields to update the necessary fields so that... be_gsa.gsa_paperprice = tbe_gallery.gallery_gsaprice_paper ????

Is my statement above anywhere close to what it should be ????

Miles.

--
MySQL General Mailing List
For list archives: http://lists.mysql.com/mysql
To unsubscribe:    http://lists.mysql.com/[EMAIL PROTECTED]

Reply via email to