I have two datatable :

```
table1:
id value label
1  val1  lbl1   
2  val2  lbl2 

table2:
id value label
1  val1  lbl1  

```

I want to compare two datatable and add a column to 1st table say 'assigned'= 'true' if it exists in table2 else false.

How do I do this? Either in c# or TSQL would help.

So the final result what I expect is:

```
    id value label assigned
    1  val1  lbl1   true
    2  val2  lbl2   false

```

here since id=1 exists in both tables it is marked as assigned and id=2 which is only present in table1 and not in table2 then it is marked as false in assigned column.

**EDIT**
I have two separate select queries to get table1 and table2 data:
Here are my queries:
**query1:**

```
select Id,label,Values from 
t1 inner join t2 
on ID=t2.UDF1ValueID inner join t3
on t2.UDFID = t3.UDF_ID
where ID=15

```

**query2**

```
select Id,label,Values from t4 w
inner join t2 on(w.Id=t2.Id)
 inner join t3 on (t3.ID=t2.ID) 
 inner join t4 on (t3.ID=t4.ID)
  where w_Id=5 and t2.ID=15

```