I have a table
key1,key2,key3
or thereabouts.

Now I want to update the value of key1 with that of a reference record
for all values of key3.

In very non-sql terms:

for all r,s in key2,key3
  if r.key3 == s.key3 AND r.key2 = <reference value>
     AND s.key2 != <reference value>
  then s.key1 = r.key1

(Just to make it more interesting: key3 is actually about a dozen 
keys, all of which have to be equal the reference record and the 
target)

Can anyone give me a hint how to do this in MySQL?

-- 
Victor Eijkhout <[EMAIL PROTECTED]>
tel: 865 974 9308 (W), 865 673 6998 (H), 865 974 8296 (F)
http://www.cs.utk.edu/~eijkhout/

---------------------------------------------------------------------
Before posting, please check:
   http://www.mysql.com/manual.php   (the manual)
   http://lists.mysql.com/           (the list archive)

To request this thread, e-mail <[EMAIL PROTECTED]>
To unsubscribe, e-mail <[EMAIL PROTECTED]>
Trouble unsubscribing? Try: http://lists.mysql.com/php/unsubscribe.php

Reply via email to