I am trying to determine what the first 5 related records to another record
are. I have created a table of matches where I have returned the unique key
value for each record in a one to many relationship. Preferrably, I would
like to update the table that contains the F_rel_num with the 5 (or less)
values for RE_rel_num in fields such as RE_rel_num1,
RE_rel_num2...RE_rel_num5. The top 5 is based on decending values for
RE_rel_num. I have included sample data below. TOP 5 in hte SELECT would not
work as I need the top 5 for each F_rel_num. Does anyone know how to do this?
I could easily write this in ASP or VB, but I need to be able to run this as
a regular SQL job, so I imagine I need to do it completely with T-SQL.