Untitled

mail@pastecode.io avatar
unknown
plain_text
6 months ago
2.6 kB
7
Indexable
Never
select * from "field"
where "tableId" = 's7TdpIAPvmOMXoY'


-- ----------------------------------------------------------------------------

SELECT 
        variant."ow2d8q3ibcA" as "magpieCodeParent",
        variant."HfMBveGAiRe" as "barcodeParent",
        concat(item."o7VMh4ojhOJ", ' ', variant."HkcvAg2zGjf")  as "magpieProductNameParent",
        brand."S9YAYtNXW3S" as "brand",
        variant_material."ow2d8q3ibcA" as "magpieCodeMaterial",
        variant_material."HfMBveGAiRe" as "barcode",
        concat(item_material."o7VMh4ojhOJ", ' ', variant_material."HkcvAg2zGjf")  as "magpieProductName"
  FROM "e8b83099-7cca-4c26-abd1-67120be3dfbd"."ZhIUGPQ6JpM" as variant
	LEFT JOIN "e8b83099-7cca-4c26-abd1-67120be3dfbd"."ZHO7JfWIRyV_relations_ZhIUGPQ6JpM" as item_rel
	  ON variant.id = item_rel."ZhIUGPQ6JpM_id"
	LEFT JOIN "e8b83099-7cca-4c26-abd1-67120be3dfbd"."ZHO7JfWIRyV" as item
	  ON item_rel."ZHO7JfWIRyV_id" = item.id
	LEFT JOIN "e8b83099-7cca-4c26-abd1-67120be3dfbd"."UiEt4Wh4Bri_relations_ZHO7JfWIRyV" as brand_rel_item
	  ON brand_rel_item."ZHO7JfWIRyV_id" = item.id
	LEFT JOIN "e8b83099-7cca-4c26-abd1-67120be3dfbd"."UiEt4Wh4Bri" as brand
	  ON brand_rel_item."UiEt4Wh4Bri_id" = brand.id
	LEFT JOIN "e8b83099-7cca-4c26-abd1-67120be3dfbd"."JrO24f5aZ6J_relations_ZhIUGPQ6JpM" as bundle_rel_brand
	  ON bundle_rel_brand."ZhIUGPQ6JpM_id" = variant.id
	LEFT JOIN "e8b83099-7cca-4c26-abd1-67120be3dfbd"."JrO24f5aZ6J" as bundle
	  ON bundle_rel_brand."JrO24f5aZ6J_id" = bundle.id
	LEFT JOIN "e8b83099-7cca-4c26-abd1-67120be3dfbd"."JrO24f5aZ6J_relations_ZJyGTQ28PSK" as bundle_rel_material
	  ON bundle_rel_material."JrO24f5aZ6J_id" = bundle.id
	LEFT JOIN "e8b83099-7cca-4c26-abd1-67120be3dfbd"."ZJyGTQ28PSK" as material
	  ON bundle_rel_material."ZJyGTQ28PSK_id" = material.id
	LEFT JOIN "e8b83099-7cca-4c26-abd1-67120be3dfbd"."ZJyGTQ28PSK_relations_ZhIUGPQ6JpM" as variant_rel_material
	  ON variant_rel_material."ZJyGTQ28PSK_id" = material.id
	LEFT JOIN "e8b83099-7cca-4c26-abd1-67120be3dfbd"."ZhIUGPQ6JpM" as variant_material
	  ON variant_rel_material."ZhIUGPQ6JpM_id" = variant_material.id
	LEFT JOIN "e8b83099-7cca-4c26-abd1-67120be3dfbd"."ZHO7JfWIRyV_relations_ZhIUGPQ6JpM" as item_rel_material
	  ON variant.id = item_rel_material."ZhIUGPQ6JpM_id"
	LEFT JOIN "e8b83099-7cca-4c26-abd1-67120be3dfbd"."ZHO7JfWIRyV" as item_material
	  ON item_rel_material."ZHO7JfWIRyV_id" = item_material.id
  WHERE
	item."AiM2JwiM6Ks" = false 
	AND material."id" IS NOT NULL 
	AND brand."S9YAYtNXW3S" NOT IN ('Testing','Bursa Sajadah','TNT POV')
ORDER BY
 "magpieCodeParent"
Leave a Comment