I have two tables in sql table1 1 2 3 5 table 2 2 3 4 6 output 2 2 3 3 4 3 6 5
select t2.*, t1.* from table2 as t2 join table1 as t1 on t1.i = (select max(t3.i) from table1 as t3 where t3.i <=t2.i)
var
This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)