开发者

need to know fieldwise count of records available in a table

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

上一篇:

下一篇:

精彩评论

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

最新问答

问答排行榜