Du kan använda villkorlig aggregering:
select ad_id,
max(case when name = 'name' then valueofname end) as name,
max(case when name = 'age' then valueofname end) as age,
max(case when name = 'birthday' then valueofname end) as birthday,
max(case when name = 'job' then valueofname end) as job
from t
group by ad_id;
I SQL Server kan du också göra något liknande med pivot
.