Я получаю следующую ошибку при выполнении этого запроса:
# 1241 - операнд должен содержать 1 столбец (столбцы)
SELECT *,
Date_format(date_assigned, '%d-%m-%y') AS datum,
YEAR(date_assigned) AS YEAR,
YEAR(NOW()) AS this_year,
Datediff(NOW(), date_assigned) AS age,
MONTH(NOW()) AS this_month,
Concat(Period_add(Date_format(date_released, "%Y%m"), -6)) AS cancel_date
,
Date_format(NOW(), '%Y%m') AS
this_date
FROM reseller_numbers
WHERE reseller_id = '31'
AND MONTH(date_assigned) = '12'
AND ( ( date_released IS NULL
OR date_released > NOW() )
OR ( Dayofyear(date_assigned) <= Dayofyear(date_released)
AND ( date_released IS NULL
OR date_released > NOW() ) ) )
AND ( date_released IS NULL
OR date_released > NOW()
AND date_released NOT LIKE '%2999%'
AND date_released != '2038-01-01 00:00:00' )
AND ( date_released NOT IN (SELECT *,
Date_format(DATE_ADD(date_released,
INTERVAL '-6' MONTH),
'%d%m%y')
AS
cancel_date
FROM reseller_numbers
WHERE reseller_id = '31'
HAVING DATE_ADD(date_released,
INTERVAL '-6' MONTH)
<
NOW(
)) )
ORDER BY date_released DESC
LIMIT 0, 30
Что-то не так с этим запросом? Когда я удаляю подзапрос в date_released NOT IN, запрос выполняется просто отлично.