Question: This is driving me crazy!
Exactly the same POST request works fine in Insomina per screenshot below:
[![enter image description here](https://i.stack.imgur.com/Z1PDO.png)](https://i.stack.imgur.com/Z1PDO.png)

The only header Insomina has is: `Content-Type: application/json`.

Now, the same request in code (**I even copied the code generated from Insomnia for axios**) via axios in Typescript:

```
  const saveReqConfig: AxiosRequestConfig = {
          method: 'POST',
          url: 'THE SAME URL USED IN Insomina',
          timeout: 3000,
          data: {
            name: `TestName`,
            uri: `TestURI`,
            statusCode: '200',
            simulatedLatency: '0',
            contentType: "application/json",
            tags: '',
            response: 'testing...',
            type: 'VA',
          },
          headers: {
            'Content-Type': 'application/json',
          }
        }
        const normalAxios = axios.create();
        const test = await normalAxios.request(saveReqConfig);

```

Don't understand why I am getting `AxiosError: Request failed with status code 400` from code but the same request works fine in Insomina.

Answer: 
You can use a `ROW_NUMBER` window function to select the first value among the `name + ' - R'/' (old)'` doubled values.

```
WITH cte AS (
    SELECT *, ROW_NUMBER() OVER(
                  PARTITION BY name, surname REGEXP name+' (- R|(old))'  
                  ORDER BY surname) AS rn
    FROM tab
)
SELECT id, name, surname
FROM cte
WHERE rn = 1

```

Check the demo [here](https://www.db-fiddle.com/f/iMdaLkipdw5mufzM7W9wHe/2).

---

Your query would get updated as such:

```
WITH cte AS (
    SELECT au.id,
           au.name,
           au.surname,
           ROW_NUMBER() OVER(
               PARTITION BY au.name, au.surname REGEXP au.name+' (- R|(old))'  
               ORDER BY au.surname) AS rn
    FROM statements s 
    JOIN aduser au ON au.id=s.id_usp
    WHERE s.id_utv = 10
)
SELECT id, name, surname
FROM cte
WHERE rn = 1
ORDER BY surname ASC

```
Change

WHERE s.id\_utv = 10

To

WHERE s.id\_utv = 10 AND INSTR(au.surename,'(old') = 0