[code]SELECT DISTINCT b.* 
  FROM jospa_hikashop_product_category AS a 
  LEFT JOIN jospa_hikashop_product AS b 
  ON a.product_id=b.product_id 
  WHERE (b.product_published = 1) 
  AND (b.product_type = 'main') 
  AND (a.category_id IN (58)) 
  AND ((b.product_access = 'all' OR b.product_access LIKE '%,9,%')) 
  ORDER BY a.ordering ASC 
  LIMIT 0, 18[/code]

[code]SELECT product_parent_id, product_id 
  FROM jospa_hikashop_product 
  WHERE product_parent_id IN ('166','167') 
  AND product_published = 1 
  AND product_type = 'variant' 
  AND product_sale_start < 1516279411 
  AND (product_sale_end > 1516279411 OR product_sale_end = 0)[/code]

[code]SELECT COUNT( DISTINCT b.product_id ) 
  FROM jospa_hikashop_product_category AS a 
  LEFT JOIN jospa_hikashop_product AS b 
  ON a.product_id=b.product_id 
  WHERE (b.product_published = 1) 
  AND (b.product_type = 'main') 
  AND (a.category_id IN (58)) 
  AND ((b.product_access = 'all' OR b.product_access LIKE '%,9,%')) 
  ORDER BY a.ordering ASC[/code]

[code]SELECT DISTINCT b.product_id  
  FROM jospa_hikashop_product_category AS a 
  LEFT JOIN jospa_hikashop_product AS b 
  ON a.product_id=b.product_id 
  WHERE (b.product_published = 1) 
  AND (b.product_type = 'main') 
  AND (a.category_id IN (58)) 
  AND ((b.product_access = 'all' OR b.product_access LIKE '%,9,%')) 
  ORDER BY a.ordering ASC[/code]

[code]SELECT DISTINCT b.product_id  
  FROM jospa_hikashop_product_category AS a 
  LEFT JOIN jospa_hikashop_product AS b 
  ON a.product_id=b.product_id 
  WHERE (b.product_published = 1) 
  AND (b.product_type = 'main') 
  AND (a.category_id IN (58)) 
  AND ((b.product_access = 'all' OR b.product_access LIKE '%,9,%')) 
  ORDER BY a.ordering ASC[/code]

[code]SELECT DISTINCT b.product_id,b.century, a.category_id  
  FROM jospa_hikashop_product_category AS a 
  LEFT JOIN jospa_hikashop_product AS b 
  ON a.product_id=b.product_id 
  LEFT JOIN jospa_hikashop_price AS pprice 
  ON b.product_id=pprice.price_product_id 
  WHERE (pprice.price_access = 'all' OR pprice.price_access LIKE '%,9,%' OR ISNULL(pprice.price_access)) 
  AND (b.product_published = 1) 
  AND (b.product_type = 'main') 
  AND (a.category_id IN (58)) 
  AND ((b.product_access = 'all' OR b.product_access LIKE '%,9,%')) 
  ORDER BY a.ordering ASC[/code]

[code]SELECT DISTINCT b.product_id,round(min( 
  case when pprice.price_currency_id IS NULL then 0 when pprice.price_currency_id = '1' then (pprice.price_value/1) when pprice.price_currency_id IS NULL then 0 when pprice.price_currency_id = '2' then pprice.price_value end ),0) as min_Price_4, round(max( 
  case when pprice.price_currency_id IS NULL then 0 when pprice.price_currency_id = '1' then (pprice.price_value/1) when pprice.price_currency_id IS NULL then 0 when pprice.price_currency_id = '2' then pprice.price_value end ),0) as max_Price_4, max(b.century) as max_Period_3, min(b.century) as min_Period_3, max(a.category_id) as max_OnHold_9, min(a.category_id) as min_OnHold_9  
  FROM jospa_hikashop_product_category AS a 
  LEFT JOIN jospa_hikashop_product AS b 
  ON a.product_id=b.product_id 
  LEFT JOIN jospa_hikashop_price AS pprice 
  ON b.product_id=pprice.price_product_id 
  WHERE (pprice.price_access = 'all' OR pprice.price_access LIKE '%,9,%' OR ISNULL(pprice.price_access)) 
  AND (b.product_published = 1) 
  AND (b.product_type = 'main') 
  AND (a.category_id IN (58)) 
  AND ((b.product_access = 'all' OR b.product_access LIKE '%,9,%')) 
  ORDER BY a.ordering ASC[/code]