select * from dbo.table where
datepart(m,QueryDate) between 6 and 12
“I sense many useless updates in you... Useless updates lead to fragmentation... Fragmentation leads to downtime...Downtime leads to suffering..Fragmentation is the path to the darkside.. DBCC INDEXDEFRAG and DBCC DBREINDEX are the force...May the force be with you" --
select * from dbo.table
where dateadd(m,6,QueryDate()) =getdate()
or
dateadd(m,12,QueryDate()) =getdate()
or is this what you are looking for??
select * from dbo.table where
QueryDate = dateadd(m,6,QueryDate())
or
QueryDate = dateadd(m,12,getdate())
“I sense many useless updates in you... Useless updates lead to fragmentation... Fragmentation leads to downtime...Downtime leads to suffering..Fragmentation is the path to the darkside.. DBCC INDEXDEFRAG and DBCC DBREINDEX are the force...May the force be with you" --
select * from dbo.table
where datepart(mm,query_date)= 6 or
datePart(mm,query_date) = 12
and can I add this select statement as a subquery and how would I do that?
query_date would be the name of the datetime filed in your Table
“I sense many useless updates in you... Useless updates lead to fragmentation... Fragmentation leads to downtime...Downtime leads to suffering..Fragmentation is the path to the darkside.. DBCC INDEXDEFRAG and DBCC DBREINDEX are the force...May the force be with you" --
This site uses cookies to help personalise content, tailor your experience and to keep you logged in if you register.
By continuing to use this site, you are consenting to our use of cookies.