SQL Server Forums
Profile | Register | Active Topics | Members | Search | Forum FAQ
 
Register Now and get your question answered!
Username:
Password:
Save Password
Forgot your Password?

 All Forums
 SQL Server 2000 Forums
 SQL Server Development (2000)
 updating with a join
 New Topic  Reply to Topic
 Printer Friendly
Author Previous Topic Topic Next Topic  

outspaced
Starting Member

United Kingdom
21 Posts

Posted - 02/02/2007 :  06:48:22  Show Profile  Reply with Quote
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
Flowing Fount of Yak Knowledge

India
5581 Posts

Posted - 02/02/2007 :  07:25:37  Show Profile  Visit harsh_athalye's Homepage  Click to see harsh_athalye's MSN Messenger address  Send harsh_athalye a Yahoo! Message  Reply with Quote
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



Harsh Athalye
India.
"The IMPOSSIBLE is often UNTRIED"
Go to Top of Page
  Previous Topic Topic Next Topic  
 New Topic  Reply to Topic
 Printer Friendly
Jump To:
SQL Server Forums © 2000-2009 SQLTeam Publishing, LLC Go To Top Of Page
This page was generated in 0.05 seconds. Powered By: Snitz Forums 2000