SQL count(*) and distinct

前端 未结 9 1988
野趣味
野趣味 2021-02-12 11:25

Why can\'t we use count(distinct *) in SQL? As in to count all distinct rows?

9条回答
  •  失恋的感觉
    2021-02-12 12:10

    COUNT(*) is the number of rows matching a query.

    A row contains unique information such as rowid. All rows are by definition distinct.

    You must count the distinct instances of values in some field instead.

提交回复
热议问题