CREATETABLE [dbo]. [Jqfk] ([id] [int] IDENTITY (1, 1) NOTNULL, [yhh] [char] (13) NULL, CREATETABLE [dbo]. [Jqfk] ([id] [int] IDENTITY (1, 1) NOTNULL, [yhh] [char] (13) NULL, [cbrq] [nvarchar] (19) NULL, [ysl] [int] NULL,) [cbrq] [nvarchar] (19) NULL ,[... mysql
Create table [dbo]. Jqfk not null,
[Yhh] char NULL, create table [dbo]. Jqfk not null,
[Yhh] char NULL,
[Cbrq] nvarchar NULL,
[Ysl] [int] NULL,
)
[cbrq] [nvarchar](19) NULL,[ysl] [int] NULL,
)
Insert into jqfk VALUES ('b173022031201 ', '2017-01-08 10:12:30', 0 );
Insert into jqfk VALUES ('b211001024011 ', '2017-01-08 10:46:13', 13 );
Insert into jqfk VALUES ('b211001024012 ', '2017-01-08 10:46:13', 0 );
Insert into jqfk VALUES ('b211001024013 ', '2017-01-08 10:46:13', 3 );
Insert into jqfk VALUES ('b211001024014 ', '2017-01-08 10:46:13', 0 );
Insert into jqfk VALUES ('b173022031201 ', '2017-02-08 10:46:13', 0 );
Insert into jqfk VALUES ('b211001024011 ', '2017-02-08 10:46:13', 0 );
Insert into jqfk VALUES ('b211001024012 ', '2017-02-08 10:46:13', 13 );
Insert into jqfk VALUES ('b211001024013 ', '2017-02-08 10:46:13', 11 );
Insert into jqfk VALUES ('b211001024014 ', '2017-02-08 10:46:13', 0 );
Insert into jqfk VALUES ('b173022031201 ', '2017-03-08 10:46:13', 0 );
Insert into jqfk VALUES ('b211001024011 ', '2017-03-08 10:46:13', 0 );
Insert into jqfk VALUES ('b211001024012 ', '2017-03-08 10:46:13', 0 );
Insert into jqfk VALUES ('b211001024013 ', '2017-03-08 10:46:13', 0 );
Insert into jqfk VALUES ('b211001024014 ', '2017-03-08 10:46:13', 0 );
Insert into jqfk VALUES ('b173022031201 ', '2017-04-08 10:46:13', 13 );
Insert into jqfk VALUES ('b211001024011 ', '2017-04-08 10:46:13', 0 );
Insert into jqfk VALUES ('b211001024012 ', '2017-04-08 10:46:13', 12 );
Insert into jqfk VALUES ('b211001024013 ', '2017-04-08 10:46:13', 0 );
Insert into jqfk VALUES ('b211001024014 ', '2017-04-08 10:46:13', 0 );
I need the number of times that the last time is 0 and then sorted in reverse chronological order as 0. In fact, we need a user whose last time is 0, and his last time is 0.
Result
1 B211001024014 4
2 B211001024011 3
3 B211001024013 2