SELECT *
FROM `products`
JOIN (
SELECT MAX(`discount_price`) AS `max_price`, `product_id`
FROM `options`
GROUP BY `product_id`
) AS `max` ON `max`.`product_id` = `products`.`id`
ORDER BY `max`.`max_price` ASC
LIMIT 24
On Windows the default value is 1. On macOS, the default value is 2. On Linux, a value of 2 is not supported; the server forces the value to 0 instead.
You should not set lower_case_table_names to 0 if you are running MySQL on a system where the data directory resides on a case-insensitive file system (such as on Windows or macOS).
It is prohibited to start the server with a lower_case_table_names setting that is different from the setting used when the server was initialized.
SELECT *
FROM `shop` AS `s1`
LEFT JOIN `shop` AS `s2` ON `s1`.`price` < `s2`.`price`
Тогда вы увидите обе соединённые таблицы.SELECT *
FROM `shop`
ORDER BY `price` DESC
LIMIT 1
WITH `cte` AS (
SELECT *,
ROW_NUMBER() OVER (
PARTITION BY `contact_id` ORDER BY `created_at` DESC
) AS `row`
FROM `contacts_history`
WHERE `created_at` BETWEEN '2021-02-05 15:56:57' AND '2021-02-20 13:44:09'
) SELECT *
FROM `cte`
WHERE `status_id` = 37
AND `row` = 1
data_issued + 10 < curdate()
`date_issued` < CURDATE() - INTERVAL 10 DAY