由Actor表

时间:2015-12-24 09:39:39

标签: sql-server group-by

我需要按照演员的所有细节进行分组。意味着我需要所有的列 到目前为止我所做的是:

SELECT Actor.Actor_id AS A,(MAX(Movie.M_year))-(MIN(Movie.M_year))AS DIFF
FROM Actor INNER JOIN (Movie INNER JOIN Acted_in ON (Acted_in.Movie_id=Movie.Movie_id))
ON (Actor.Actor_id=Acted_in.Actor_id)
GROUP BY Actor.Actor_id

如何解决此问题并选择所有列?我只能为id列做这个。

1 个答案:

答案 0 :(得分:0)

你的语法错了。试试这个:

<webHttpBinding>
   <binding name="webBinding">          
   </binding>
</webHttpBinding>

如果您想要更多列,则可以将其添加为:

SELECT Actor.Actor_id AS A,(MAX(Movie.M_year))-(MIN(Movie.M_year))AS DIFF
FROM Actor INNER JOIN Acted_in ON Actor.Actor_id=Acted_in.Actor_id
INNER JOIN Movie ON Acted_in.Movie_id=Movie.Movie_id
GROUP BY Actor.Actor_id