Please start any new threads on our new
site at https://forums.sqlteam.com. We've got lots of great SQL Server
experts to answer whatever question you can come up with.
Author |
Topic |
glda19
Starting Member
3 Posts |
Posted - 2015-05-03 : 12:24:57
|
HiHow can i to a select * form tblInschrijvingenbetween 2 date i have a colum begindate and enddatewhat is the correct sql state ment |
|
Kristen
Test
22859 Posts |
Posted - 2015-05-03 : 13:02:28
|
[code]select *form tblInschrijvingenWHERE YourDateColumn >= begindate AND YourDateColumn < enddate[/code]If [enddate] itself is to be INCLUDED then you need[code]select *form tblInschrijvingenWHERE YourDateColumn >= begindate AND YourDateColumn < DATEADD(Day, 1, enddate)[/code]If begindate and enddate are DATETIME and MAY include a "time" portion then you also need to remove the time component. If you need to do that please ask and we can tell you how to. |
|
|
jeffw8713
Aged Yak Warrior
819 Posts |
Posted - 2015-05-05 : 13:47:38
|
If your table has columns for begindate and enddate - and you want to find any rows where an input date (or today) is between those two dates (inclusive) you would use something like this:DECLARE @inputDate datetime = getdate();SELECT * FROM {your table} WHERE @inputDate BETWEEN BeginDate AND EndDate; |
|
|
|
|
|