Skip to content

Instantly share code, notes, and snippets.

@kitt-vl
Last active October 15, 2018 06:02
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save kitt-vl/30f6d86496dd3e8f92826f7b15537154 to your computer and use it in GitHub Desktop.
Save kitt-vl/30f6d86496dd3e8f92826f7b15537154 to your computer and use it in GitHub Desktop.
SELECT "Cart"."unit",
"Cart"."price",
"Cart"."quantity",
"Cart"."summa",
"Cart"."catalog_id",
"Catalog"."url", -- <---Ooops =(
"Catalog_Image"."url",
"Catalog_Parent"."url_uniq"
FROM "Cart"
LEFT JOIN "Catalog" AS "Catalog" ON "Cart"."catalog_id" = "Catalog"."id"
LEFT JOIN "Files" AS "Catalog_Image" ON "Catalog"."main_image" = "Catalog_Image"."id"
LEFT JOIN "Catalog" AS "Catalog_Parent" ON "Catalog"."parent_id" = "Catalog_Parent"."id"
WHERE "Cart"."user_id" = ?
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment