Question: How I will convert this SQL query in Linq, sorry but I am not that much expert in LINQ

```
select ConnectionId
from LearnerConnections
where LearnerId = 1
union
select LearnerId
from LearnerConnections
where ConnectionId = 1

```

also can I write the DataTable methode to get the result (like DataTable.Select() method)?

thanks in advance

Answer: 
something like that

```
LearnerConnections.Where(x => x.LearnerId == 1)
                  .Select(m => m.ConnectionId)
                  .Union(LearnerConnections.Where(l => l.ConnectionId ==1)
                                           .Select(lc => lc.LearnerId)

                  );

```

with a datatable, it should look like

```
  dtLearnerConnections.AsEnumerable()
                      .Where(m => m.Field<int>("LearnerId") == 1)
                      .Select(m => m.Field<int>("ConnectionId"))
                      .Union(dtLearnerConnections.AsEnumerable()
                                                 .Where(x => x.Field<int>("ConnectionId") == 1)
                                                 .Select(x => x.Field<int>("LearnerId"))
                      );

```
```
var result = (from lc in LearnerConnections
              where lc.LearnerId == 1
              select lc.ConnectionId)
              .Union
             (from lc in LearnerConnections
              where lc.ConnectionId == 1
              select lc.LearnerId);

```

If you are using DataTables, this involves the use of [LINQ to DataSet](http://blogs.msdn.com/b/adonet/archive/2007/01/26/querying-datasets-introduction-to-linq-to-dataset.aspx). This SO [question](https://stackoverflow.com/questions/10855/linq-query-on-a-datatable) might also help you.