SELECT customer.cusnum, customer.cusname, customer.cussex, customer.cusid, customer.cusphone, worker.workname, worker.worksex, worker.workid, worker.worksalaryFROM customerJOIN workerON customer.cussex LIKE '%女%' AND worker.worksex LIKE '%男%'; ERROR 1064 (42000): 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 'workerON customer.cussex LIKE '%女%' AND worker.worksex LIKE '%男%'' at line 1
时间: 2024-02-27 20:56:47 浏览: 115
mybatis 获取mysql插入记录的自增长字段值.pdf
非常抱歉,我的上一个回答中确实存在错误。正确的SQL语句应该在FROM和JOIN之间添加一个空格,如下所示:
```
SELECT customer.cusnum, customer.cusname, customer.cussex, customer.cusid, customer.cusphone,
worker.workname, worker.worksex, worker.workid, worker.worksalary
FROM customer
JOIN worker
ON customer.cussex LIKE '%女%' AND worker.worksex LIKE '%男%';
```
这个SQL语句应该可以成功执行,并返回满足条件的记录。如果还有其他问题,请随时提出。
阅读全文