Re: UPDATE based on value in another table

2003-08-26 Thread otherguy
On Monday, August 25, 2003, at 03:26 PM, Dan Jones wrote: [snip] To make this a tad clearer, I have two tables: Title and Author. Author consists of the Author's name and an AuthorID. Title includes an AuthorID from the Author table. Some of the Author's have been deleted from the Author tab

Re: UPDATE based on value in another table

2003-08-25 Thread Dan Jones
On Sat, 2003-08-23 at 22:19, Rajesh Kumar wrote: > Dan Jones unknowingly asked us: > > > UPDATE table1 SET table2ID = NULL WHERE table1.table2ID NOT FOUND IN > > table2.ID; > > > > The NOT FOUND IN isn't SQL, of course, but I'm not sure what should go > > there. > > In MySql, its 'NOT IN' > > a

Re: UPDATE based on value in another table

2003-08-25 Thread Victoria Reznichenko
Dan Jones <[EMAIL PROTECTED]> wrote: > How do I update a table to remove orphaned references to a second > table? I've deleted rows in the second table, which has a unique > auto_increment key. The first table now has references to keys that no > longer exist. I need to update the first table, s

Re: UPDATE based on value in another table

2003-08-24 Thread Rajesh Kumar
Dan Jones unknowingly asked us: UPDATE table1 SET table2ID = NULL WHERE table1.table2ID NOT FOUND IN table2.ID; The NOT FOUND IN isn't SQL, of course, but I'm not sure what should go there. In MySql, its 'NOT IN' and not 'NOT FOUND IN'. To delete all references, you need to set up a Trigger. O

UPDATE based on value in another table

2003-08-23 Thread Dan Jones
How do I update a table to remove orphaned references to a second table? I've deleted rows in the second table, which has a unique auto_increment key. The first table now has references to keys that no longer exist. I need to update the first table, setting the value to NULL where the referenced