Files
bewell-in-ua/lib/db/prisma/sql/getCategoryBySlugWitData.sql
2025-02-07 08:34:42 +02:00

27 lines
844 B
SQL

SELECT
p.id as productId,
pl.lang,
pl.slug,
pr.uri as image,
pr.width as imageWidth,
pr.height as imageHeight,
pts.price,
pts.price_promotional as pricePromotional,
cl.category_id as categoryId,
pl.title,
pl.short_title as shortTitle,
pl.description,
-- pl.content,
pl.heading_title as headingTitle,
-- pl.instruction,
cl.slug as categorySlug,
cl.title as categoryTitle
FROM products p
JOIN categories_on_products cop ON p.id = cop.product_id
JOIN product_locale pl ON pl.product_id = p.id
JOIN category_locales cl ON cl.category_id = cop.category_id
JOIN product_to_store pts ON pts.product_id = p.id AND pts.store_id = cop.store_id
LEFT JOIN product_resources pr ON p.id = pr.product_id AND pr.isFeature = TRUE
WHERE cop.store_id = 1 AND cl.slug = ?
ORDER BY pl.lang;