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
 Other Forums
 MS Access
 query problem

Author  Topic 

dinzg
Starting Member

6 Posts

Posted - 2005-02-12 : 17:40:50

I have Table: players and Query: years

Query: years counts age of players and now I want to insert age from query into players (table)

can someone help me?

players:
ID surname yearofbirth
----------------------

and

years:
ID surname age
----------------------

spirit1
Cybernetic Yak Master

11752 Posts

Posted - 2005-02-12 : 18:49:36
will this do?

update t1
set YearOfBirth = year(getdate()) - t2.age -- i assumed this is what you want based on column names
from players t1
inner join years t2 on t1.id = t2.id and t1.surname=t2.surname

Go with the flow & have fun! Else fight the flow
Go to Top of Page

dinzg
Starting Member

6 Posts

Posted - 2005-02-15 : 07:41:03
I made it with this one:
UPDATE players INNER JOIN years ON [players].[ID]=[years].[ID] SET players.age = [years].[age];

thanks for help
Go to Top of Page
   

- Advertisement -