Created
May 21, 2019 01:33
-
-
Save kochie/540ec2ca50e912d1dbfcb04ee83c7a93 to your computer and use it in GitHub Desktop.
Revisions
-
kochie created this gist
May 21, 2019 .There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters. Learn more about bidirectional Unicode charactersOriginal file line number Diff line number Diff line change @@ -0,0 +1,10 @@ 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; This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters. Learn more about bidirectional Unicode charactersOriginal file line number Diff line number Diff line change @@ -0,0 +1,8 @@ SELECT mp.pid AS "~id", mp."title" AS "~label", mp.catid AS "catid", mc.category AS "category" FROM "mumumango"."product" as mp JOIN "mumumango"."category" as mc ON mp.catid=mc.catid ORDER BY mp.pid