SELECT * from (select distinct sls_q,to_party_id,to_party_nm,sub_brand,cast(sub_brand as varchar) sub_brand,sku,sls_qty from sls )
PIVOT(max(sls_qty) AS sls_qty FOR sub_brand IN ('zz','ee','hh')) TMP where to_party_id in (xxx)