Hi,I have a bit of an issue. I have 3 columns in 3 different tables and I need to find out if the values are in the correct sequence.declare @Table1 table (number int, number1 int)declare @Table2 table (number int, Outputfile varchar(100))declare @Table3 table (number int, SequenceNo int)insert into @Table1select 1,4500union select 2,4501union select 3,4503union select 4,4504union select 5,5501union select 6,5502union select 7,5504insert into @Table2select 1, 'First Output'union select 2, 'First Output'union select 3, 'First Output'union select 4, 'First Output'union select 5, 'Second Output'union select 6, 'Second Output'union select 7, 'Second Output'insert into @Table3select 1, 1union select 2,2union select 3,5union select 4,4union select 5,3union select 6,2union select 7,1select t1.number, t2.Outputfile, t3.SequenceNo from @Table2 t2 inner join @Table3 t3 on t3.number = t2.numberinner join @Table1 t1 on t1.number = t3.numberorder by t2.Outputfile, t1.number1
What I have so far is the above, but in reality I have over a million rows to check and am racking my brains to find a way to check this automatically. Can anyone help?