PDA

View Full Version : update across two tables


nanny
01-23-2009, 02:36 AM
Hi I am wanting to update the primary id in one column and with the same query update that column in another table.
I tried INNER JOIN and it says not a unique id

UPDATE categorytype INNER JOIN photo ON categorytype.categorytype = photo.categorytype SET name=%s WHERE categorytype=%s


Bit clueless with joins I'm afraid.

nanny
01-23-2009, 02:40 AM
It says:
Column 'categorytype' in where clause is ambiguous
Then I didn't join the two and it updates the two tables automatically. So sorry this one is solved.

davidj
01-23-2009, 06:11 AM
so you have 2 tables

the first you use an ID to perform the update and your wanting to update the second using the same ID

nanny
01-30-2009, 02:47 AM
Thanks this one is solved - didn't need to join it worked on its own but I will direct a new question similar as a new thread.