SELECT cs.taskname, rt.taskcont, rp.YEAR, rp.taskcont rpname, rp.iszb, ni.id, ifnull( ni.totalfinance, '0' ) totalfinance, ifnull( ni.centralfinance, '0' ) centralfinance, ifnull( ni.localfinance, '0' ) localfinance, ifnull( ni.investedfinance, '0' ) investedfinance, ifnull( ni.supportfinance, '0' ) supportfinance, ifnull( ni.selffinance, '0' ) selffinance, ni.statusnum FROM nk_xjsg_constask cs JOIN nk_xjsg_refinetask rt ON cs.id = rt.taskid AND cs.customerid = rt.customerid JOIN nk_xjsg_refinetask_process rp ON rt.id = rp.rtaskid AND rt.customerid = rp.customerid LEFT JOIN nk_xjsg_itembudget ni ON ni.rpid = rp.id AND ni.customerid = rp.customerid join nk_xjsg_process_leader nl on nl.itemid = rp.id and nl.customerid = rp.customerid join nk_user_info nui on nui.id = nl.tid and nui.customerid = nl.customerid where cs.pid = '40289e8c87fff7f80188042c15d50010' and ni.flowtaskid in ('40289e8b87a7c0ef0188527f09700206','40289e8b87a7c0ef018852359f600204') where cs.pid = '40289e8c87fff7f80188042c15d50010' > 1064 - You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near 'where cs.pid = '40289e8c87fff7f80188042c15d50010'' at line 33 哪里错了
时间: 2024-01-16 14:05:11 浏览: 101
NXP i.MX RT1052 FreeRTOS实战:SRAM静态创建单任务
根据错误提示,可以看出问题出在第二个 `where` 子句上。在 SQL 语句中,每个 `where` 子句应该只出现一次。因此,您需要删除第二个 `where` 子句,并将其与第一个 `where` 子句合并。合并后的 SQL 语句如下所示:
```
SELECT
cs.taskname,
rt.taskcont,
rp.YEAR,
rp.taskcont rpname,
rp.iszb,
ni.id,
ifnull(ni.totalfinance, '0') totalfinance,
ifnull(ni.centralfinance, '0') centralfinance,
ifnull(ni.localfinance, '0') localfinance,
ifnull(ni.investedfinance, '0') investedfinance,
ifnull(ni.supportfinance, '0') supportfinance,
ifnull(ni.selffinance, '0') selffinance,
ni.statusnum
FROM
nk_xjsg_constask cs
JOIN nk_xjsg_refinetask rt ON cs.id = rt.taskid AND cs.customerid = rt.customerid
JOIN nk_xjsg_refinetask_process rp ON rt.id = rp.rtaskid AND rt.customerid = rp.customerid
LEFT JOIN nk_xjsg_itembudget ni ON ni.rpid = rp.id AND ni.customerid = rp.customerid
JOIN nk_xjsg_process_leader nl ON nl.itemid = rp.id AND nl.customerid = rp.customerid
JOIN nk_user_info nui ON nui.id = nl.tid AND nui.customerid = nl.customerid
WHERE
cs.pid = '40289e8c87fff7f80188042c15d50010'
AND ni.flowtaskid IN ('40289e8b87a7c0ef0188527f09700206', '40289e8b87a7c0ef018852359f600204')
```
阅读全文