Please start any new threads on our new site at https://forums.sqlteam.com. We've got lots of great SQL Server experts to answer whatever question you can come up with.

 All Forums
 SQL Server 2000 Forums
 SQL Server Development (2000)
 updating with a join

Author  Topic 

outspaced
Starting Member

21 Posts

Posted - 2007-02-02 : 06:48:22
Hi,

I want to update a field in a table (Images) that contains a directory path to remove the first directory in that path. The problem is, I only want to update records that do not have a corresponding entry in another table (Products). I can't work out how to get the join to work. This is what I have, but it just errors:


update Images
left join Product on Product.frontcoverid = Images.id
Set Path = substring(Path, charindex('/',Path)+1, len(Path))
where Product.frontcoverid is null


I get : Incorrect syntax near the keyword 'left'.

... any ideas?

Thanks,
Alex

harsh_athalye
Master Smack Fu Yak Hacker

5581 Posts

Posted - 2007-02-02 : 07:25:37
[code]update I
Set Path = substring(Path, charindex('/',Path)+1, len(Path))
From Images as I
left join Product P on P.frontcoverid = I.id
where P.frontcoverid is null[/code]


Harsh Athalye
India.
"The IMPOSSIBLE is often UNTRIED"
Go to Top of Page
   

- Advertisement -