This is the first time i used transpose so i dont know if what i want is possible or not
this is my query
SELECT *
FROM crosstab(
'select p.name, a.attributekey, a.attributevalue
from productz p
join attribute a on a.itemid=p.id
order by p.name, a.attributekey')
AS final_result(name varchar, interface varchar, negativemargin varchar,parity varchar);
select p.name, a.attributekey, a.attributevalue
from productz p
join attribute a on a.itemid=p.id
order by p.name, a.attributekey;
here's the link http://rextester.com/IQNSY51011
but the output is different than what i want, because productz 1 have two row and the productz 2 have 3 row
name interface negativemargin parity
dufan true true NULL
waterboom android true false
the output i want is this below without insert interface,Null to database
name interface negativemargin parity
dufan NULL true true
waterboom android true false
Note: please click "run it" after opening the link