SELECT distinct
(b.siz) as origSiz,
max(CASE WHEN b.siz_alias IS NULL OR RTRIM(LTRIM(b.siz_alias)) = '' THEN b.siz ELSE b.siz_alias END) as siz,
max(b.size_order) as size_order,
max(a.sku_id) as sku_id,
max(a.scale_entry_id) as scale_entry_id,
sum(e.qoh) as qoh,
max(a.style_id) as style_id
FROM tb_skus a WITH (NOLOCK)
LEFT JOIN tb_size_entries b WITH (NOLOCK)
on (b.scale_entry_id = a.scale_entry_id)
INNER JOIN (
SELECT DISTINCT sku_id
, sum(qoh+qc) as qoh
FROM dbo.tb_sku_buckets WITH (NOLOCK)
WHERE store_id in(98,8,9,2,5,7,6,3)
GROUP BY sku_id
) e on (a.sku_id = e.sku_id)
LEFT JOIN tb_attr1_entries d WITH (NOLOCK)
on (d.attr1_entry_id = a.attr1_entry_id)
LEFT JOIN
(
SELECT style_id
FROM tb_styles WITH (NOLOCK)
WHERE web_style = ?
and web_style is not null
) sq
ON(a.style_id = sq.style_id)
WHERE (sq.style_id is not null OR a.style_id = ?)
AND (b.siz_alias is null OR b.siz_alias NOT IN ('NO SHOW','NOSHOW') )
AND isNull(a.sell_web,'Y') = 'Y'
AND e.qoh > 1
GROUP BY b.siz
ORDER BY max(b.size_order), max(a.scale_entry_id)

SQLPARAMETERS

array

1

S-MAPPGYMB

2

93776

query

RESULTSET

query

ATTR1

ATTR1_ALIAS

ATTR1_ENTRY_ID

FAM

HEX

ORIGATTR1

QOH

SIZE

SKU_ID

SORT_ORDER

STYLE_ID

1

MTT_BLK

[empty string]

76018

[empty string]

[empty string]

MTT_BLK

2

2068

361436

[empty string]

93776

CACHED

false

EXECUTIONTIME

1

SQL

SELECT distinct (b.attr1) as origAttr1, max(b.attr1_alias) as attr1_alias, max(CASE WHEN b.attr1_alias IS NULL OR RTRIM(LTRIM(b.attr1_alias)) = '' THEN b.attr1 ELSE b.attr1_alias END) as attr1, max(a.sku_id) as sku_id, max(b.attr1_entry_id) as attr1_entry_id, sum(e.qoh) as qoh, max(b.attr1_order) as sort_order, max(c.attr1_hex) as hex,max(d.attr1_fam) as fam, max(a.style_id) as style_id, max(a.SCALE_ENTRY_ID) as size
FROM tb_skus a
LEFT JOIN tb_attr1_entries b WITH (NOLOCK) ON (b.attr1_entry_id = a.attr1_entry_id)
INNER JOIN (
SELECT DISTINCT sku_id
, sum(qoh+qc) as qoh
FROM dbo.tb_sku_buckets WITH (NOLOCK)
WHERE store_id in(98,8,9,2,5,7,6,3)
GROUP BY sku_id
) e on (a.sku_id = e.sku_id)
LEFT JOIN tb_attr1_hexes c WITH (NOLOCK) ON (b.attr1=c.attr1)
LEFT JOIN tb_size_entries k WITH (NOLOCK) on (k.scale_entry_id = a.scale_entry_id)
LEFT JOIN tb_attr1_families d WITH (NOLOCK) ON (c.attr1_fam_id = d.attr1_fam_id)
WHERE
a.style_id =? AND (b.attr1_alias is null OR b.attr1_alias NOT IN ('NO SHOW','NOSHOW') )
AND e.qoh > 1
AND isNull(a.sell_web,'Y') = 'Y'
GROUP BY b.attr1
ORDER BY sum(e.qoh) DESC --max(b.attr1_order), max(b.attr1_entry_id)

SQLPARAMETERS

array

1

93776

Selected Color

query

RESULTSET

query

ATTR1_ENTRY_ID

ATTR2_ENTRY_ID

DEPT

PURCHASE_AMOUNT

QOH

SCALE_ENTRY_ID

SKU_ID

STORE_ID

STYLE

1

76018

37226

51-CLOTHING ACC.

[empty string]

2

2068

361436

98

S-MAPPGYMB

CACHED

false

EXECUTIONTIME

21

SQL

SELECT sum(c.qoh+c.qc) as qoh
,max(b.sku_id) as sku_id
, max(b.scale_entry_id) as scale_entry_id
, max(b.attr2_entry_id) as attr2_entry_id
, max(e.attr1_entry_id) as attr1_entry_id
, max(g.dept) as dept
, max(a.style) as style
, max(c.store_id) as store_id
, max(h.purchase_amount) as purchase_amount
FROM tb_styles a
LEFT JOIN tb_skus b WITH (NOLOCK) ON (a.style_id = b.style_id)
LEFT JOIN tb_sku_buckets c WITH (NOLOCK) ON (b.sku_id = c.sku_id)
LEFT JOIN tb_size_entries d WITH (NOLOCK) ON (d.scale_entry_id = b.scale_entry_id)
LEFT JOIN tb_attr1_entries e WITH (NOLOCK) ON (e.attr1_entry_id = b.attr1_entry_id)
LEFT JOIN tb_attr2_entries f WITH (NOLOCK) ON (f.attr2_entry_id = b.attr2_entry_id)
LEFT JOIN tb_taxonomy g WITH (NOLOCK) ON (g.taxonomy_id = a.taxonomy_id)
LEFT JOIN web_product_information h WITH (NOLOCK) ON (a.style_id = h.style_id)
WHERE
(b.style_id IN (
SELECT style_id
FROM tb_styles
WHERE web_style = 'S-MAPPGYMB'
) or b.style_id =?)
and c.store_id in(98,8,9,2,5,7,6,3)
--AND c.qoh > 1
and b.attr1_entry_id = 76018
and b.attr2_entry_id = 37226
AND isNull(b.sell_web,'Y') = 'Y'
GROUP BY b.sku_id
ORDER BY b.sku_id

SQLPARAMETERS

array

1

93776

2

query

RESULTSET

query

AMOUNT

FROM_PRICE

TERM_SALE_ID

TERM_SALE_ID

TYP

CACHED

false

EXECUTIONTIME

6

SQL

SELECT b.typ,b.amount,a.term_sale_id, a.term_sale_id, b.from_price
FROM tb_term_sale_entries b
LEFT JOIN tb_term_sales a WITH (NOLOCK) ON (a.term_sale_id=b.term_sale_id)
LEFT JOIN tb_styles c WITH (NOLOCK) ON (c.style_id=b.style_id)
WHERE b.start_date<= '2019-09-15 08:12:00'
AND b.end_date >= '2019-09-15 08:12:00'
and (b.store_id=89 or ISNULL(b.store_id,'') = '')
and b.style_id=93776 and a.approved='Y'
and isNull(b.attr1_entry_id,76018)=76018 and isNull(b.attr2_entry_id,37226)=37226
ORDER BY a.term_sale_id desc

Be in charge of the outdoors when you don the Suncloud Mayor Sunglasses. Influential styling and masterful design are only equaled by the comfort and effortless wear of this self-assured style. Polarized lenses reduce glare and provide 100% protection from harmful UV rays.