在一个select中使用union和count(*)

时间:2014-02-25 10:00:16

标签: sql union

这是我的尝试:

(select p.Id, p.Name, count(g.Day)
 from Points p, Game g
 where p.Id = g.Id
 group by p.Id, p.Name)
union
(select p.Id, p.Name, 0
 from Points p
 where p.Id not in 
 (select g1.Id from Game g1));

它不能用于计数,只能用和。为什么呢?

0 个答案:

没有答案
相关问题