SQLTeam.com | Weblogs | Forums

Join to key on tab2.col2 such that tab2.col2 is "Max of values less than" Tab1.col1

#1

Tab1 has col1 that has values 10,20,30,40,50
Tab2 has col2 that has values 19,8,39,25,45

I need to write a query to joins data like this
10-8
20-19
30-25
40-39
50-45

Join to key on tab2.col2 such that tab2.col2 is "Max of values less than" Tab1.col1