Question: Hi I have been following the [tutorials in youtube](https://www.youtube.com/watch?v=DKuGU5CYV_E&t=159s) it uses CLI container to add an org. Since using CLI container is not recommended to have in production environment how to add an org into the existing network withput using cli container

Answer: 
I think this the simpliest solution...:

```
select top 1 * from MY_VIEW
where lastname = 'Collins' and firstname = 'Frank'
order by dateto desc

```

or more edible:

```
select top 1 * from MY_VIEW
where lastname + ' ' + firstname = 'Collins Frank'
order by dateto desc

```
You don't need CTE, just use `TOP WITH TIES` + `ROW_NUMBER()`

```
SELECT TOP 1 WITH TIES *
FROM guests
ORDER BY ROW_NUMBER() OVER(PARTITION BY lastname, firstname ORDER BY dateto DESC)

```