Here is an example SQL query to solve the problem:

```
SELECT AVG(Salary) AS AverageSalary
FROM EmployeeSalaries
WHERE EndDate >= DATEADD(year, -1, GETDATE()) 
AND DATEDIFF(month, StartDate, EndDate) >= 6;
```

This query selects the average salary in the `EmployeeSalaries` table, where the `EndDate` is within the last year and the duration between `StartDate` and `EndDate` is at least 6 months. The `DATEADD` function is used to subtract 1 year from the current date (`GETDATE()`). The result is returned as a single column with an alias `AverageSalary`.
Data una tabella degli stipendi dei dipendenti con le colonne EmployeeID, Salary, StartDate e EndDate, scrivere una query SQL per trovare lo stipendio medio dei dipendenti che hanno lavorato almeno 6 mesi e hanno lasciato l'azienda nell'ultimo anno.