I've 2 tables in database name Tab1 & Tab2.
Tab1 consists of following columns.
Tab2 consists of following columns.
and a datatable named tempTab.
tempTab consists of following columns.
There are large amount of data(7 million each) in Tab1 and Tab2, and tempTab consists of few data(say 500). Now i've to check which rows from tempTab exist in Tab1 & Tab2. what I did is that I iterate tempTab(within a for loop) and create connection with Database every time to run a query (
select t1.Col1,t1.Col4,t2.Col7 from Tab1 t1 join Tab2 t2 on t1.Col2=t2.Col2 where t1.Col1='tempTab.Col1' and t1.Col4='tempTab.Col4' and t2.Col6='tempTab.Col6' and t2.Col7='tempTab.Col7'
). Thus i've to hit Database 500 times within that loop(for loop) for iterating. I think, this is bad practice. It took more time also.
Is there any solutions for this ???
Please help as soon as possible.
Thanks in advance.