I have a table defined as follows:
Participants
Participant varchar(5)
SpanStart int
SpanEnd int
OriginalStart int
Example data is
PARTICIPANT SPANSTART SPANEND ORIGINALSTART
12345 20090101 0
I need to update the Participant table OriginalStart column
with the latest startdate from another table, membership,
which is less than or equal to the spanstart in the participant table.
Here is the Membership table ddl and sample data
Member varchar(5)
Startdate int
Enddate int
MemberNbr Startdate Enddate
12345 20070101 20071231
12345 20080201 20090131
12345 20090301 0
So in the case described above, I need to populate the
participant table record originalstart with 20080201
Any TSQL help?