Hi! I used below query for get person by register date. When I defined date by interval its not worked, show wrong result.
DECLARE @Person AS TABLE(Id INT,Person VARCHAR(10),insertDate date)
INSERT INTO @Person VALUES(1,'Rustam','2019-01-18')
INSERT INTO @Person VALUES(2,'Firuzjon','2019-01-17')
INSERT INTO @Person VALUES(3,'Sadriddin','2019-02-01')
INSERT INTO @Person VALUES(4,'Mansur','2019-02-09')
INSERT INTO @Person VALUES(5,'Asror','2019-02-07')
INSERT INTO @Person VALUES(6,'Yakub','2018-02-01')
INSERT INTO @Person VALUES(7,'Karomatullo','2019-02-11')
INSERT INTO @Person VALUES(8,'Nurullo','2018-02-03')
INSERT INTO @Person VALUES(9,'Suhrob','2019-02-01')
INSERT INTO @Person VALUES(10,'Safar','2018-10-01')
INSERT INTO @Person VALUES(11,'Samandar','2018-12-01')
select * from @Person where CONVERT(varchar(10),insertDate,104) >= CONVERT(varchar(10),'01.02.2019',104) and CONVERT(varchar(10),insertDate,104)<=CONVERT(varchar(10),'11.02.2019',104)
I need below result:
Id
|
Person
|
insertDate
|
3
|
Sadriddin
|
2019-02-01
|
4
|
Mansur
|
2019-02-09
|
5
|
Asror
|
2019-02-07
|
7
|
Karomatullo
|
2019-02-11
|
9
|
Suhrob
|
2019-02-01
|