在sqlserver中选择Count(*)

在sqlserver中选择Count(*)

问题描述:

我想从数据库中选择一条记录,如下所示:

I want to select a record from my database like this :

SELECT [No_Jadwal]
      ,[No]
      ,[id_slot], count (*)
  FROM [FKIP-UNILAK].[dbo].[Jadwal]
group by [id_slot] having count(*) > 1



但这是行不通的.它仅在语法如下时才起作用:



But it won''t work. It only works when the syntax is like this:

SELECT [id_slot], count(*) "Jumlah Bentrok"
  FROM [FKIP-UNILAK].[dbo].[Jadwal]
group by [id_slot] having count(*) > 1



我应该怎么办?因为我也必须显示[No_Jadwal]和[No].

谢谢:)



What should I do? Because I have to show the [No_Jadwal] and [No] too.

Thanks :)

列[No_Jadwal]和[No]必须出现在GROUP BY子句中.
Columns [No_Jadwal] and [No] must appear in the GROUP BY clause.