分享起源:在写数据库思考题5作业
- select distinct 课程名 as 选过的课程名
from kc join xs_kc
using(课程号);
写到此代码运行时,先是出现了问题:1267 - Illegal mix of collations (gb2312_chinese_ci,IMPLICIT) and (latin1_swedish_ci,IMPLICIT) for operation '='
后又出现了
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 '27 select distinct 课程名 as 选过的课程名
from kc join xs_kc
using(' at line 1
解决方案:序号27代入运行命令符一起运行了,所以出现了1064错误,只要将序号27删除即可解决
反过头来发现原来是由于自己从word文档中写好作业后复制过来,忘记将序号删除了,因此导致了运行出错
然后,跟着老师的
师SELECT DISTINCT 课程号
FROM KC INNER JOIN XS_KC;
又出现了问题:1052 - Column '课程号' in field list is ambiguous
对于此问题不知大家有没有什么好的解决方法呢?请在下列评论区留下您的想法吧