我可以運行該SQL成功地:計數(不同(列))
select count(distinct(BusinessEntityID)) from Person.Person
但是如果我想知道這個,給我的錯誤:
select count(distinct(*)) from Person.Person
我怎樣才能運行equliviant SQL ?
我可以運行該SQL成功地:計數(不同(列))
select count(distinct(BusinessEntityID)) from Person.Person
但是如果我想知道這個,給我的錯誤:
select count(distinct(*)) from Person.Person
我怎樣才能運行equliviant SQL ?
您可以使用這樣的查詢表來獲得不同的記錄數:
select count(*) from (select distinct * from Person.Person) as T
在內部選擇您檢索重複的記錄,並在外層一個你得到的計數。
請直接使用count(*)
例如:
select count(*) from Person.Person
例如,表中沒有主鍵。表中有重複的行。計數功能的輸出是什麼? – Mustafa
在這種情況下,您使用DISTINCT(column_name)代替(*) – javidrathod
有什麼錯誤? – Robert