SQL |
SELECT top 10 style_id
, max(webstyle) as webstyle
, max(url) as url
, max(realName) as realName
, max(style) as style
, max(overallqoh) as overallqoh
, max(sale) as sale
, max(new) as new
, max(SmallPicture) as SmallPicture
, max(MediumPicture) as MediumPicture
, max(LargePicture) as LargePicture
, max(sortposition) as sortposition
, max(dept) as dept
, max(typ) as typ
, max(subtyp1) as subtyp1
, max(subtyp2) as subtyp2
, max(subtyp3) as subtyp3
, max(brand) as brand
, max(branddisplay) as branddisplay
, max(priceRange) as priceRange
, min(salePriceRangeBottom) as salePriceRangeBottom
, max(salePriceRangeTop) as salePriceRangeTop
, max(ListPrice) as ListPrice
, max(ranking) as ranking
, max(romanticcopylong) as romanticcopylong
, max(romanticcopyshort) as romanticcopyshort
, max(depttree) as depttree
, max(attr1list) as attr1list
, max(famlist) as famlist
, max(sizelist) as sizelist
, max(name) as name
, max(prodreviewsaverage) as prodreviewsaverage
, max(INTERNALLISTPRICE) as INTERNALLISTPRICE
, max(INTERNALMARKDOWN) as INTERNALMARKDOWN
, max(INTERNALPRICE) as INTERNALPRICE
, max(TERMSALELISTPRICE) as TERMSALELISTPRICE
, max(TERMSALEPRICE) as TERMSALEPRICE
, max(TERMSALE) as TERMSALE
, max(of1) as of1
, max(of2) as of2
, max(of3) as of3
, max(of4) as of4
, max(of5) as of5
, max(of6) as of6
, max(of7) as of7
, max(of8) as of8
, max(of9) as of9
, max(of10) as of10
, max(of11) as of11
, max(of12) as of12
, max(of13) as of13
, max(of14) as of14
, max(of15) as of15
, max(of16) as of16
, max(of17) as of17
, max(of18) as of18
, max(of19) as of19
, max(of20) as of20
, min(sortposition) as sortposition
, max(quantitysoldsum) as sold
, CASE WHEN isNull(max(picture_id),0) = 0 THEN 0 ELSE 1 END as hasImage
, CASE WHEN isNull(max(weighted_search),0) = 1 THEN 900000000 ELSE 0 END as weighted_search
FROM web_all_products
WHERE 1=1
--AND pictureid is not null
and ltrim(rtrim(dept)) = ? and ltrim(rtrim(typ)) = 'EMPTY'
AND (
1=2
OR upper(brand) like ?
OR upper(brand) like ?
OR upper(brand) like ?
OR upper(brand) like ?
OR upper(brand) like ?
)
GROUP BY STYLE_ID |