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
 Transact-SQL (2000)
 Help with Update

Author  Topic 

mike123
Master Smack Fu Yak Hacker

1462 Posts

Posted - 2004-04-25 : 23:50:32

I'm having a bit of a problem writing this SPROC, any helps appreciated. I think its pretty straight forward but I havent done

For every row in "tblUsers" I'd like to update it with the value that corresponsds to the UserID and photoID ='0' in the table "tblphotos". I can join these tables on the column UserID. I need to get the value of "uniqueID" into the "picselected" field.

tblUsers
userid, name, picselected

tblphotos
userid, photoID, uniqueID

Thanks alot
Mike123

harshal_in
Aged Yak Warrior

633 Posts

Posted - 2004-04-26 : 01:53:02
update tblusers set picselected=uniqueid from tblphotos where tblusers.userid=tblphotos.userid and tblphotos.photoid='0'

He is a fool for five minutes who asks , but who does not ask remains a fool for life!<N>

http://www.sqldude.4t.com
Go to Top of Page
   

- Advertisement -