CodePudding user response:
Count (0) group by date, personCodePudding user response:
Use tempdb for
GO
IF OBJECT_ID (' t ') IS NOT NULL
DROP TABLE t
CREATE TABLE (t
[name] [nvarchar] (10) NULL,
[ndate] [datetime] NULL
) ON the (PRIMARY)
Insert into t values (' zhang ', '2021-4-21 08:10:10)
Insert into t values (' zhang ', '2021-4-21 08:30:10)
Insert into t values (' bill ', '2021-4-21 09:10:10)
Insert into t values (' Cathy ', '2021-4-21 09:10:10)
Select distinct name, CONVERT (nvarchar (10), ndate, 10)
The from t
Line - how many how many head, even if don't feel directly, and the outer sheath child
Select count (*) from
(select distinct name, CONVERT (nvarchar (10), ndate, 10) ndate from t) tt