total records in sql server code example
Example 1: sql query to get the number of rows in a table
SELECT COUNT(*) FROM tablename
Example 2: count number of entries including 0s sql
-- If the table which contains the primary key is
-- mentioned first in the QUERY then use LEFT join else RIGHT join.
select WARDNO, count(WARDCODE) from MAIPADH
right join MSWARDH on MSWARDH.WARDNO = MAIPADH.WARDCODE
group by WARDNO