【发布时间】:2018-04-19 18:34:23
【问题描述】:
我已经创建了两个表:
create table movies(id integer, name text, score integer);
create table cast(movie_id integer, cast_id integer, cast_name text);
我需要前 10 名(不同,按演员姓名字母顺序)演员和他们的平均电影分数,所以我尝试了:
select movie_id,cast_id,cast_name,id,score from cast,movies
where movies.id=cast.movie_id and cast_name in
(select distinct cast_name from cast order by cast_name limit 10);
但后来我收到一条错误消息:靠近“。” : 语法错误
在那之后,我试着让它更简单:
select cast_name, score from cast,movies where movies.id=cast.movie_id;
我仍然遇到同样的错误。
我猜这可能是因为 '.'是sqlite3中的一个特殊命令,但是不知道怎么解决这个问题。
任何帮助将不胜感激。
【问题讨论】: