SELECT substring_index(id,'!', 1) AS Style, manufacturer AS BrandCode, department AS DeptCode, class AS ClassCode, subclass AS SubclassCode, category AS CategoryCode, description AS Description, extdescription AS ExtDescription, CASE pictureext WHEN 'gif' THEN CONCAT('/istarimages/p/t/pt-', replace(replace(replace(replace(replace(replace(replace(replace(id, ' ', '+'), '!', '%21'), "'", '%27'), '-', '%2D'), '/', '-'), '(', '%28'), ')', '%29'), '&', '%26'), '.gif') WHEN 'jpg' THEN CONCAT('/istarimages/p/t/pt-', replace(replace(replace(replace(replace(replace(replace(replace(id, ' ', '+'), '!', '%21'), "'", '%27'), '-', '%2D'), '/', '-'), '(', '%28'), ')', '%29'), '&', '%26'), '.jpg') ELSE '/istarimages/default/t/default_image-100x100.gif' END AS Thumbnail, CONCAT( '/store/', id, '/', replace(replace(replace(replace(replace(replace(replace(replace(description, ' ', '+'), '!', '%21'), "'", '%27'), '-', '%2D'), '/', '-'), '(', '%28'), ')', '%29'), '&', '%26')) AS URL, price_low AS PriceLow, price_high AS PriceHigh, sp_cmp_price_low AS SpecialPriceLow, sp_cmp_price_high AS SpecialPriceHigh, cmp_at_price_low AS ComparePriceLow, cmp_at_price_high AS ComparePriceHigh, CASE WHEN price_low < price_high THEN CONCAT('$', price_low, ' - $', price_high) ELSE CONCAT('$', price_low) END AS Price, CASE WHEN cmp_at_price_low < cmp_at_price_high THEN CONCAT('$', cmp_at_price_low, ' - $', cmp_at_price_high) ELSE CONCAT('$', cmp_at_price_low) END AS ComparePrice, CASE WHEN sp_cmp_price_low < sp_cmp_price_high THEN CONCAT('$', sp_cmp_price_low, ' - $', sp_cmp_price_high) ELSE CONCAT('$', sp_cmp_price_low) END AS SpecialComparePrice, CASE WHEN price_low < sp_cmp_price_low OR price_high < sp_cmp_price_high THEN 1 ELSE 0 END AS OnSale FROM products WHERE id = '688370-407!NK'