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)
 Updating one cloumn based on infroamtion from two columns in a differant table

Author  Topic 

AskSQLTeam
Ask SQLTeam Question

0 Posts

Posted - 2002-04-18 : 09:42:23
Matt writes "I am trying to update a single column in my database based on the information in two different columns in another table. I have posted the question on the forum but know one is able to give me an answer that works (and it has been almost 3 days now!) so I came to you. Here is the information:
Table to be updated: PublicINFO
Column name: Doing
Table reading information from: PrivetINFO
Column names: Doing, MoveTime

I want it so when the doing column in privetinfo says anything starting with Learning and the movetime says anything but "N/A" then the doing column in publicinfo is changed to "Learning a move". Here is the code I though would work but does not:


Update PublicINFO Set
PublicINFO.doing = 'Learning a move'
From PublicINFO, PrivetINFO
Where PublicINFO.F_PlayerID=PrivetINFO.F_playerID
and publicinfo.doing = 'Learning%'

I also want it so that when the privetinfo's doing column reads anything starting with "Learning" and the movetime column reads "N/A" that the publicinfo column doing is changed to Training and that the doing column in the privetinfo is changed to "Normal training".

Thanks for you help."

robvolk
Most Valuable Yak

15732 Posts

Posted - 2002-04-18 : 09:58:00
http://www.sqlteam.com/forums/topic.asp?TOPIC_ID=14830

Go to Top of Page
   

- Advertisement -