System. Diagnostics. process. Start (@ "D: \ Foxmail \ foxmail.exe ");
Select *
From monthlypolicisemonitor
Where cast ([year] As nvarchar (10) + '-0' + Cast ([month] As nvarchar (10) +'-01 00:00:00'
Between '2017-01-01 00:00:00 'and '2017-02-28 23:59:59'
Declare @ t table (ID int, name varchar (10), time1 datetime, time2 datetime)
Insert @ t select 1, 'A', '2017-5-10 ', '2017-1-1'
Insert @ t select 2, 'A', '2017-11-5 ', null
Insert @ t select 3, 'bb ', '2014-5-10', '2014-2-14'
Insert @ t select 4, 'bb ', '2017-8-23', '2017-1-5'
Insert @ t select 5, 'bb ', '2017-9-14', '2017-4-1'
Insert @ t select 6, 'cc', '2017-2-22 ', null
Insert @ t select 7, 'cc', '2017-10-10 ', '2017-1-10'
Select * From @ t where not exists (select 1 from @ t where name = T. Name and (time1> T. time1 or time2> T. time2 ))
/*
ID name time1 time2
-------------------------------------------------------------------
2 AA 2008-11-05 00:00:00. 000 null
5 BB 00:00:00. 000 00:00:00. 000
6 cc 2009-02-22 00:00:00. 000 null
(3 rows affected)
*/
Http://www.cikuu.com/contact.html
Select * From DBO. t_question
Where (tag like n' % card % points % 'and tag not like n' % points % ')
Or (tag not like n' % card % points % 'and tag like n' % points % ')