开发者

need to know fieldwise count of records available in a table

开发者 https://www.devze.com 2023-03-19 13:43 出处:网络
Can u help I need to know fieldwise count of records available in a table. Ex: tablename = contactinfo Fields in table: Name, Dsgn, City

Can u help

I need to know fieldwise count of records available in a table.

Ex: tablename = contactinfo Fields in table: Name, Dsgn, City

Need the result a开发者_高级运维s

Name = 1000, Dsgn = 990, City = 850

Like that

Anoop


Standard SQL to give number of distinct non-null values uses

SELECT
   COUNT(DISTINCT Name),
   COUNT(DISTINCT Dsgn),
   COUNT(DISTINCT City)
FROM
   contactinfo 

Just non-null values counting duplicates

SELECT
   COUNT(Name),
   COUNT(Dsgn),
   COUNT(City)
FROM
   contactinfo 


If you mean fields where the field is not null, then it is a simple:

SELECT count(*) FROM contactinfo WHERE Name IS NOT NULL

and repeat :)

0

精彩评论

暂无评论...
验证码 换一张
取 消