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
 Update table A from TOP in table B

Author  Topic 

pkipe
Starting Member

6 Posts

Posted - 2012-04-05 : 17:31:46
Given table A as follows:

pk_a expiration_date
1 1/15/2012
2 1/15/2012
3 2/12/2012

and table B as follows:

pk_b fk_a date_expires
1 1 1/15/2012
2 1 1/15/2013
3 2 1/15/2012
4 2 1/15/2013
5 3 2/12/2011
6 3 2/12/2012
7 3 2/12/2013

How can I write an update query in SQL that will update A.expiration_date with B.date_expires from the highest B.pk_b for the join between A.pk_a and B.fk_a?

Thanks in advance,

Pete

robvolk
Most Valuable Yak

15732 Posts

Posted - 2012-04-05 : 17:38:57
Dupe:

http://www.sqlteam.com/forums/topic.asp?TOPIC_ID=173329
Go to Top of Page

robvolk
Most Valuable Yak

15732 Posts

Posted - 2012-04-06 : 06:51:02
Sorry about locking the topic, just noticed the duplicate original question and not the replies in the other thread.

Generally we prefer to stick with the original post even if it's in the wrong forum, it lessens confusion over multiple posts.

Regarding your question, I posted a possible solution in the original thread.
Go to Top of Page
   

- Advertisement -