Mysql error Operand should contain 1 column(s)
1. An error
ERROR 1241 (21000): Operand should contain 1 column(s)
2. Report the cause of the error
This statement mostly occurs because the result set of the SELECT is wrapped in (). It is normal to enclose ()
with select
, but it is possible that the fields are misused, as shown in the following SQL:
select
pit_key
,employee_code
,department_id
,value_date
from pit_employee_department ped
where ped.employee_code = 'GSCQ3349'
and ped.value_date < date_format(date_sub(curdate(), interval day(curdate()) - 1 day),'%Y%m%d')
and ped.pit_key not in
( select
pit_key
,value_date
from pit_employee_department ped_1
inner join
(
select
max(value_date) as max_date
from pit_employee_department ped
where ped.value_date <= date_format(date_sub( date_sub(curdate(), interval day(curdate()) - 1 day),interval 1 month),'%Y%m%d')
and employee_code = 'GSSH0039'
)ped_2
on ped_1.value_date < ped_2.max_date
and ped_1.employee_code = 'GSSH0039'
);
The reason for executing this error in the above SQL statement is that pit_key
and value_date
are used in the subquery, and the comparison option is pit_key not in (...).
, field inconsistency results in an error.
3. Solutions
Make changes for different reasons.
Read More:
- MySQL error operation should contain 1 column (s)
- Idea2021 reports an error. Default operand size is 64 sets the startup task to automatically add the registry
- MySQL error 1054 (42s22) unknown column ‘password’ in ‘field list’
- MySQL ERROR 1054 (42S22): Unknown column’password’ in’field list’ error
- TypeError: unsupported operand type(s) for *: ‘range‘ and ‘int‘
- MySQL password setting error message: error 1054 (42s22): unknown column ‘password’ in ‘field list’
- QT + MySQL generates an EXE file and reports an error “driver not loaded”. Solution steps
- Error 1136 (21s01): column count doesn’t match value count at row 1
- Docker starts MySQL container and reports an error driver failed programming external connectivity on endpoint mysq
- MySQL – ERROR 1146 (42S02): Table ‘mysql.user’ doesn’t exist
- How to Fix SQL Error: 1054, SQLState: 42S22 Unknown column ‘markcardex0_.art_service_time’ in ‘field list’
- Zeppelin uses spark to connect to MySQL and reports an error
- MySQL unknown column ‘in’ field list ‘solution
- MySQL error: column ‘ID’ in field list is ambiguous
- Hadoop reports an error. Cannot access scala.serializable and python MapReduce reports an error
- The echots in Vue reports an error. After obtaining the DOM element, the chart can be displayed. The console still reports an error
- Top35: pychar reports an error when connecting to MySQL server returns invalid timezone. Need to set ‘servertimezone’ property
- HTML method IE8 reports an error, IE8 jQuery Ajax obtains static resources reports an error, typeerror denies access
- MySQL reports error 1292 (22007) failure
- The file server reports an error of 413, and the file uploaded by nginx reports an error of 413 request entity too large