SELECT CONCAT(CAST(m1.lid AS VARCHAR),
         '-',CAST(m2.lid AS VARCHAR)) AS "id", 
         CONCAT(CAST(m1.pid AS VARCHAR),'-',CAST(m2.pid AS VARCHAR)) AS "~id", 
         m1.pid AS "~to", m2.pid AS "~from", 
         m1.quantity*m2.quantity AS "weight",
         'boughtTogether' AS "~label"
FROM "mumumango"."lineitem" AS m1, "mumumango"."lineitem" AS m2
WHERE m1.lid<m2.lid
        AND m1.oid=m2.oid
ORDER BY  m1.lid;