SQL- Select just on row
<p><a href="https://i.stack.imgur.com/3iZ6y.png" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/3iZ6y.png" alt="enter image description here"></a></p>

<p>As you shown in the image that have a lot of addressTypeID with the same Application id and ValidTo Date rows.</p>

<p>sometimes need to use the <code>AddressTypeID</code> as a condition on the returned column.</p>

<p>I need to make the query that will get the validTo in condition with AddressType and some details from application table which connect to the applicationID:</p>

<pre><code>SELECT APPLICATION_ID, FIRST_NAME, LAST_NAME
,MAIL_DATE = (SELECT VALIDTO FROM ADDRESS WHERE ADDRESSTYPEID = 1)
</code></pre>

<p>i need the output be just one row that contain that:</p>

<pre><code>applicationid - firstname - lastname - validto
38  - John   - smith   - 2020-12-31 00:00:00.000
39  - Math   - Will    - 2015-09-23 00:00:00.000
</code></pre>

<p>without make the row be repeated.</p>