• Luis Cazares (10/4/2013)


    You might want to add a column to your queries, using ROW_NUMBER().

    Here's an example, but without some data more similar to the real data, it's hard to give a good option.

    WITH t1 AS(

    SELECT *,

    ROW_NUMBER() OVER( Order BY Id) AS rn

    FROM Table1

    ),

    t2 AS(

    SELECT *,

    ROW_NUMBER() OVER( Order BY Code) AS rn

    FROM Table2

    )

    SELECT *

    FROM t1

    JOIN t2 ON t1.rn = t2.rn

    Luis you beauty....THANK YOU.....it worked perfect on my real data and gives exactly what i was looking for.