I edited my answer so the solution for my question is:
select  DISTINCT e.Cod_proiect
     , p.Descriere
     , p.Stare
     , p.ClientService
     , e.Data
  from ExpPoz as e 
  join Proiecte as p 
    on e.Cod_proiect=p.Cod_proiect 
             join ( 
                     select cod_proiect, max(data) maxDt 
                     from ExpPoz
                     group by cod_proiect 
                  ) latest on latest.cod_proiect = e.cod_proiect and latest.maxDt = e.Data and p.Stare='I'
Which gives the following error: Subquery returned more than 1 value I am trying to get every line with the maximum date.
I have the following table structure:
a    date1
a    date2
a    date3
b    date4
b    date5
The output should be, supposing that date3 and date5 are the oldest/biggest:
a   date3
b   date5
Thanks in advance.
 
     
     
    