SELECT
  products.product_id AS product_id,
  products.image AS image,
  product_description.name AS name,
  products.model AS model,
  products.price AS price,
  products.quantity AS quantity,
  products.status AS STATUS,
  products.noindex AS noindex
FROM
  oc_product AS products
  INNER JOIN oc_product_description AS product_description ON products.product_id = product_description.product_id
  AND product_description.language_id = 1
  LEFT JOIN (
    SELECT
      ps1.product_id,
      ps1.price
    FROM
      oc_product_special AS ps1
      INNER JOIN (
        SELECT
          product_id,
          MIN(
            CONCAT(
              LPAD(priority, 5, '0'),
              LPAD(price, 10, '0')
            )
          ) AS sort_key
        FROM
          oc_product_special AS ps
        WHERE
          ps.customer_group_id = 1
          AND (
            ps.date_start = '0000-00-00'
            OR ps.date_start < NOW()
          )
          AND (
            ps.date_end = '0000-00-00'
            OR ps.date_end > NOW()
          )
        GROUP BY
          product_id
      ) AS ps2 ON ps1.product_id = ps2.product_id
      AND CONCAT(
        LPAD(ps1.priority, 5, '0'),
        LPAD(ps1.price, 10, '0')
      ) = ps2.sort_key
  ) AS product_specials_7de8997be994ada47d62cdfe2b7369c9 ON products.product_id = product_specials_7de8997be994ada47d62cdfe2b7369c9.product_id
WHERE
  COALESCE(
    product_specials_7de8997be994ada47d62cdfe2b7369c9.price,
    products.price
  ) = 100