SQL
SELECT
m.MEETING_ID,
m.MEETING_ID,
m.MEETING_NAME,
m.MEETING_REMARK,
m.MEETING_PLACE,
m.MEETING_DATE,
wp.PROJECT_ID,
wp.REQUISITION_PROJECT_ID,
(SELECT s.* FROM act_hi_taskinst c, staff s WHERE c.ASSIGNEE_ = s.STAFF_ID AND c.PROC_INST_ID_ = wmpr.INSTANCE_ID ORDER BY c.START_TIME_ DESC LIMIT 1) as NODE_ID,
wmpr.INSTANCE_ID,
(SELECT CONCAT('["',GROUP_CONCAT(w.COMMITTEE_MEMEBER SEPARATOR '","'),'"]')
FROM wf_meeting_appr_opinion w
WHERE w.REQ_REQUISITION_PROJECT_ID = wmpr.REQUISITION_PROJECT_ID
AND w.IS_DELETE ='N'
GROUP BY w.REQ_REQUISITION_PROJECT_ID) AS meetingPersonId,
m.BU,
m.CREATION_BY,
m.CREATION_DATE,
m.IS_DELETE,
m.MODIFICATION_BY,
m.MODIFICATION_DATE,
m.ID_REFERENCE
FROM
a m,
b wmpr,
c wp,
d wmao
WHERE
m.MEETING_ID = wmpr.MEETING_ID
AND wmpr.REQUISITION_PROJECT_ID = wp.REQUISITION_PROJECT_ID
AND m.MEETING_ID = wmao.MEETING_ID
GROUP BY MEETING_ID
原表名已替换成a,c,c,d ,并不影响整体SQL
问题
Operand should contain 1 column(s)
翻译
“操作数应包含1列”
原因
原因是我的子查询查询出的数据不止一个字段,但是我却在整体SQL中 把子查询出来的结果 作为一个字段的 NODE_ID 了
只要把s.* 改成 我需要的 s.STAFF_ID 即可解决问题查询出结果
(SELECT s.* FROM act_hi_taskinst c, staff s WHERE c.ASSIGNEE_ = s.STAFF_ID AND c.PROC_INST_ID_ = wmpr.INSTANCE_ID ORDER BY c.START_TIME_ DESC LIMIT 1) as NODE_ID,
改为
(SELECT s.staff_id FROM act_hi_taskinst c, staff s WHERE c.ASSIGNEE_ = s.STAFF_ID AND c.PROC_INST_ID_ = wmpr.INSTANCE_ID ORDER BY c.START_TIME_ DESC LIMIT 1) as NODE_ID,
即可解决