mySQL date difference with days in current month

Hi,

I have some bookings in mySQL like this:

Arrive..............Depart
2015-10-15.....2015-11-03
2015-10-30.....2015-11-18
2015-11-03.....2015-11-16
2015-10-30.....2015-12-02

What I'd like to do is calculate how many days of those bookings are in the current month.

So for month 11 in year 2015, it would return:
Arrive..............Depart.............Days
2015-10-15.....2015-11-03.....3
2015-10-30.....2015-11-18.....18
2015-11-03.....2015-11-16.....13
2015-10-29.....2015-12-02.....30

Thanks in advance
kbitAsked:
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.

Julian HansenCommented:
Misread question
Julian HansenCommented:
Try this
SELECT 
    Arrive, 
    Depart, 
    30 - CASE 
      WHEN A.arriveDiff > 0 THEN A.arriveDiff ELSE 0 
   END - 
   CASE
      WHEN A.departDiff > 0 THEN A.departDiff ELSE 0 
   END AS Days
    FROM ( 
    SELECT 
      Arrive, 
      Depart, 
      Arrive - DATE('2015-11-01') AS arriveDiff, 
      DATE('2015-11-30') - Depart  AS departDiff 
    FROM ee21 
    HAVING ABS(arriveDiff) < 30 OR ABS(departDiff) < 30
  ) A 

Open in new window

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
kbitAuthor Commented:
Wow this is a tremendous piece of work, thanks ever so much, I have lots to learn
Julian HansenCommented:
You are welcome.
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
MySQL Server

From novice to tech pro — start learning today.