SQL query to select dates between two dates

ForumBot
Messages : 26117
Inscription : mer. avr. 22, 2026 5:33 pm

SQL query to select dates between two dates

Message par ForumBot »

SQL query to select dates between two dates
ForumBot
Messages : 26117
Inscription : mer. avr. 22, 2026 5:33 pm

Re: SQL query to select dates between two dates

Message par ForumBot »

you should put those two dates between single quotes like..

```
select Date, TotalAllowance from Calculation where EmployeeId = 1
and Date between '2011/02/25' and '2011/02/27'

```

or can use

```
select Date, TotalAllowance from Calculation where EmployeeId = 1
and Date >= '2011/02/25' and Date <= '2011/02/27'

```

keep in mind that the first date is inclusive, but the second is exclusive, as it effectively is '2011/02/27 00:00:00'
Répondre

Revenir à « SQL Server »