Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations Wanet Telecoms Ltd on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Simple update im sure

Status
Not open for further replies.

saintedmunds

Technical User
Apr 7, 2006
78
GB
Hi

Im sure this is easy but cant get my head around it.
I have one table which i woul like to update from its self ie.
StudentID SymbolsID EnglishTaker MathsTaker etc

I want to update the Takers from SymbolsID2 To SymbolsID3 where the StudentID is the same.

Do i Make any sense?

Cheers
 
Where the StudentID is the same as what?

Do you have multiple rows for each StudentID?

Hope this help,

Alex

Ignorance of certain subjects is a great part of wisdom
 
I would help us if you would provide sample data and what results you would like to get.

-SQLBill

Posting advice: FAQ481-4875
 
Hi Sorry


This should help

StudentID SymbolsID EnglishTaker ScienceTaker MathsTaker FrenchTaker HistoryTaker GeographyTaker LatinTaker
12 2 TSW Set 1 Jco Set 1
12 3
20 2 TSW Set 1 HCh Set 1 jco Set 1
20 3
26 2 TSW Set 1 HCh Set 1 Jco HBP Set 2
26 3
 
Make sure you have a backup of this database before you run this.

Code:
[COLOR=blue]Update[/color] A
[COLOR=blue]Set[/color]    A.EnglishTaker = B.EnglishTaker,
       A.ScienceTaker = B.ScienceTaker
[COLOR=blue]From[/color]   Student A
       [COLOR=blue]Inner[/color] [COLOR=blue]Join[/color] Student B
         [COLOR=blue]On[/color]  A.StudentId = B.StudentId
         And B.SymbolsId = 2
         And A.SymbolsId = 3

-George

Strong and bitter words indicate a weak cause. - Fortune cookie wisdom
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top