I´m fairly new to SQL and can´t get this around my head and need some help!

My table look something like this:

```html
<table border="1" cellspacing="0" cellpadding="0">
    <tbody>
        <tr>
            <td width="307" colspan="3" valign="top">
                <p>
                    <strong>Kompetens</strong>
                </p>
            </td>
        </tr>
        <tr>
            <td width="102" valign="top">
                <p>
                    <strong>Emp.nr</strong>
                </p>
            </td>
            <td width="102" valign="top">
                <p>
                    <strong>Code</strong>
                </p>
            </td>
            <td width="102" valign="top">
                <p>
                    <strong>EndDate</strong>
                </p>
            </td>
        </tr>
        <tr>
            <td width="102" valign="top">
                <p>
                    111
                </p>
            </td>
            <td width="102" valign="top">
                <p>
                    Dansa1
                </p>
            </td>
            <td width="102" valign="top">
                <p>
                    2015-01-01
                </p>
            </td>
        </tr>
        <tr>
            <td width="102" valign="top">
                <p>
                    111
                </p>
            </td>
            <td width="102" valign="top">
                <p>
                    Dansa2
                </p>
            </td>
            <td width="102" valign="top">
                <p>
                    2015-02-01
                </p>
            </td>
        </tr>
        <tr>
            <td width="102" valign="top">
                <p>
                    222
                </p>
            </td>
            <td width="102" valign="top">
                <p>
                    Dansa1
                </p>
            </td>
            <td width="102" valign="top">
                <p>
                    2015-01-01
                </p>
            </td>
        </tr>
        <tr>
            <td width="102" valign="top">
                <p>
                    222
                </p>
            </td>
            <td width="102" valign="top">
                <p>
                    Dansa2
                </p>
            </td>
            <td width="102" valign="top">
            </td>
        </tr>
        <tr>
            <td width="102" valign="top">
                <p>
                    333
                </p>
            </td>
            <td width="102" valign="top">
                <p>
                    Dansa1
                </p>
            </td>
            <td width="102" valign="top">
            </td>
        </tr>
        <tr>
            <td width="102" valign="top">
                <p>
                    333
                </p>
            </td>
            <td width="102" valign="top">
                <p>
                    Dansa2
                </p>
            </td>
            <td width="102" valign="top">
                <p>
                    2015-02-02
                </p>
            </td>
        </tr>
        <tr>
            <td width="102" valign="top">
                <p>
                    444
                </p>
            </td>
            <td width="102" valign="top">
                <p>
                    Dansa1
                </p>
            </td>
            <td width="102" valign="top">
                <p>
                    2015-01-01
                </p>
            </td>
        </tr>
        <tr>
            <td width="102" valign="top">
                <p>
                    444
                </p>
            </td>
            <td width="102" valign="top">
                <p>
                    Dansa2
                </p>
            </td>
            <td width="102" valign="top">
                <p>
                    2015-02-01
                </p>
            </td>
        </tr>
    </tbody>
</table>
```

I would like to merge into 1 row per employee where both Dansa1 and Dansa2 has a EndDate. Like this:

```html
<table border="1" cellspacing="0" cellpadding="0">
    <tbody>
        <tr>
            <td width="102" valign="top">
                <p>
                    <strong>Emp.nr</strong>
                </p>
            </td>
            <td width="102" valign="top">
                <p>
                    <strong>EndDate</strong>
                </p>
            </td>
        </tr>
        <tr>
            <td width="102" valign="top">
                <p>
                    111
                </p>
            </td>
            <td width="102" valign="top">
                <p>
                    2015-02-01
                </p>
            </td>
        </tr>
        <tr>
            <td width="102" valign="top">
                <p>
                    444
                </p>
            </td>
            <td width="102" valign="top">
                <p>
                    2015-02-01
                </p>
            </td>
        </tr>
    </tbody>
</table>
```

I also use a string variable to select wich employees to include:

```css
SELECT [Emp.nr], [Code]
FROM [Kompetens]
WHERE [Emp.nr] IN @strEmp.nr
```