Query from month to month

Dear expert

Please read query below. This query will show from 2017-12-01 to today 2018-02-27 result, now I only want to see one month result. Any good way to do it? For exemple: I would like to show FROM 2017-12-01 to 2018-01-01 2018-01-01 to 2018-02-01 and 2018-02-01 to 2018-02-27

Thanks

DECLARE
	@SendoutMonth date = '2017-12-01'

SELECT *
FROM
	Invoice.Head H
WHERE
	H.DoElectronicInvoice = 1
	AND H.DateInvoice >= @SendoutMonth

Open in new window

LVL 1
WeTiAsked:
Who is Participating?

[Product update] Infrastructure Analysis Tool is now available with Business Accounts.Learn More

x
I wear a lot of hats...

"The solutions and answers provided on Experts Exchange have been extremely helpful to me over the last few years. I wear a lot of hats - Developer, Database Administrator, Help Desk, etc., so I know a lot of things but not a lot about one thing. Experts Exchange gives me answers from people who do know a lot about one thing, in a easy to use platform." -Todd S.

Jim HornMicrosoft SQL Server Developer, Architect, and AuthorCommented:
>I would like to show FROM 2017-12-01 to 2018-01-01 2018-01-01 to 2018-02-01 and 2018-02-01 to 2018-02-27
Just for kicks and giggles give us a data mockup of how exactly you wish to see this.
0
Scott PletcherSenior DBACommented:
DECLARE
      @SendoutMonth date = '2017-12-01'

SELECT *
FROM
      Invoice.Head H
WHERE
      H.DoElectronicInvoice = 1
      AND H.DateInvoice >= @SendoutMonth
      AND H.DateInvoice < DATEADD(MONTH, 1, @SendoutMonth)
0

Experts Exchange Solution brought to you by

Your issues matter to us.

Facing a tech roadblock? Get the help and guidance you need from experienced professionals who care. Ask your question anytime, anywhere, with no hassle.

Start your 7-day free trial
WeTiAuthor Commented:
currentdate is: 2018-03-01, I would like to see the 2018-02-01 to 2018-03-01 result, and I would also want to see the 2018-01-01 to 2018-02-01 result as well.
0
WeTiAuthor Commented:
Thanks yes it worked, you basicly add more month to 2. Thanks
0
It's more than this solution.Get answers and train to solve all your tech problems - anytime, anywhere.Try it for free Edge Out The Competitionfor your dream job with proven skills and certifications.Get started today Stand Outas the employee with proven skills.Start learning today for free Move Your Career Forwardwith certification training in the latest technologies.Start your trial today
Query Syntax

From novice to tech pro — start learning today.