失眠网,内容丰富有趣,生活中的好帮手!
失眠网 > 3836mysql数据库应用基础教程答案_mysql intersect

3836mysql数据库应用基础教程答案_mysql intersect

时间:2019-08-03 14:30:55

相关推荐

3836mysql数据库应用基础教程答案_mysql intersect

问题

I'm new to mysql so please be kind. I'm getting the following error for my script and im not sure whats wrong with it.

SELECT uoid

FROM mint

WHERE mint_id='6' and userid='3836'

INTERSECT

SELECT id as uoid

FROM cats

WHERE category='Health, Fitness'

ORDER BY 1;

gives

#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 'INTERSECT SELECT id as uoid FROM cats WHERE category='Health, Fitness'' at line 4

回答1:

MySQL does not have an INTERSECT keyword. See this question and this one for suggestions about how to achieve what you're after.

回答2:

INTERSECT is not supported in MySQL. You need to restructure your query somehow. You might be able to use a subquery if you version of MySQL supports subqueries.

回答3:

This is because intersect only work on same table, not on different tables as you are trying.

See this

In place of intersect use join statement syntax.

And INTERSECT does exist in sql

来源:/questions/10433587/mysql-intersect

如果觉得《3836mysql数据库应用基础教程答案_mysql intersect》对你有帮助,请点赞、收藏,并留下你的观点哦!

本内容不代表本网观点和政治立场,如有侵犯你的权益请联系我们处理。
网友评论
网友评论仅供其表达个人看法,并不表明网站立场。