If the header field is present in a request and none of the available representations for the response have a media type that is listed as acceptable, the origin server can either honor the header field by sending a 406 (Not Acceptable) response or disregard the header field by treating the response as if it is not subject to content negotiation.
CREATE TABLE `chats` (
`user_id` VARCHAR(32),
`chat_id` INT
);
INSERT INTO `chats` VALUES
(`pupkin_v`, 1),
(`sidorov_m`, 1),
(`petrov_v`, 1);
SELECT `f`.`user_id`, `t`.`user_id`
FROM `chats` AS `f`
JOIN `chats` AS `t` ON `t`.`chat_id` = `f`.`chat_id`;
И ещё замечание, постоянное использование to_date() означает, что вы неверно выбрали формат хранения данных. Для дат есть отдельный тип DATE. А в текущем варианте у вас постоянно будут медленные запросы без использования индексов - по функциям индексы не работают.