Hi, I am using this query for count SELECT Count(ID) from Table But its showing the count of all the fields which are empty and zeros. I want the count of fields which are empty and zero. please guide me.

Thanks.
Take care.

Recommended Answers

All 3 Replies

SELECT 
  info.SiteId ,
  info.Alias,
  info.Code,
  info.NewID,
  count(info.Longitude),
  count(info.Lat),
  info.Address,
  info.Region,
  info.City,
  info.District,
  info.MaintainedBy,
  info.StatusNopatPat,
  info.Ownership,
  info.StatusOnairOffair,
  info.OnAirDate,
  info.Rollout,
  info.Phase,
  info.Priority,
  info.DependentSites,
  info.GuardedUnguarded,
  info.GreenFieldRoofTop,
  info.IndoorOutdoor,
  info.HODate,
  info.Host,
  info.Guest,
  info.pdf
FROM
  info
  where info.Longitude is null or info.Longitude=""

It only show Empties and zeros values of longitude
how I show count for all fields.

*edit* I misunderstood your post, sorry.

Dear friend

You should use the "WHERE" condition

Like the below code

Select count(field name) where name=''

Thanks

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.