Try this:
SELECT t2.*
FROM Table1 AS t1 INEER JOIN Table2 AS t2 ON t1.Tab1ID = t2.Tab1ID
WHERE t1.Condition = 'Jan'
More about joins:
http://www.w3schools.com/sql/sql_join.asp[
^]
Visual Representation of SQL Joins[
^]
[EDIT #1]
If those are datatables, use select on first datatable to find matching
Tab1Id
, then use the same method on the second datatable with the corresponding
Tab1Id
.
Datatable.Select method[
^]
[/EDIT]
[EDIT #2]
Example:
DataTable table1 = DataSet1.Tables["Table1"];
DataTable table2 = DataSet1.Tables["Table2"];
string firstcondition = "Condition='Jan'";
DataRow[] foundTab1Rows;
DataRow[] foundTab2Rows;
foundTab1Rows = table1.Select(firstcondition);
for(int i = 0; i < foundTab1Rows.Length; i ++)
{
string secondcondition = "TablId=" + foundTab1Rows[i][colIndexForTab1Id];
foundTab2Rows = table2.Select(secondcondition);
for(int j = 0; j < foundTab2Rows.Length; j ++)
{
Console.WriteLine(foundTab2Rows[j][0]);
}
}
[/EDIT]