assuming the combination (deviceId, fieldName) is unique,
select distinct deviceid,
(select fieldValue from aaa a1 where a1.deviceid=aaa.deviceid and
a1.fieldName='color') color,
....
from aaa
note that your original table is NOT, repeat NOT normalized. You might
need to learn more about normalization