Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 8393871
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 9, 20262026-06-09T19:55:00+00:00 2026-06-09T19:55:00+00:00

I can get the 15/02 – 21/06 date range data on every year from

  • 0

I can get the 15/02 – 21/06 date range data on every year from the query below.

SELECT * FROM dim_date
WHERE EXTRACT (MONTH FROM date_cal) BETWEEN 3 AND 5
 OR (EXTRACT (MONTH FROM date_cal) = 2 AND EXTRACT (DAY FROM date_cal) >= 15)
 OR (EXTRACT (MONTH FROM date_cal) = 6 AND EXTRACT (DAY FROM date_cal) <= 21)

But the problem is, when i want to find from year 2010 - 2012, I get back the same result.

Range that i want to get:

2010-02-15 - 2010-06-15
2011-02-15 - 2011-06-15
2012-02-15 - 2012-06-15

SELECT * FROM dim_date
WHERE EXTRACT (MONTH FROM date_cal) BETWEEN 3 AND 5
 OR (EXTRACT (MONTH FROM date_cal) = 2 AND EXTRACT (DAY FROM date_cal) >= 15)
 OR (EXTRACT (MONTH FROM date_cal) = 6 AND EXTRACT (DAY FROM date_cal) <= 21)
AND EXTRACT (YEAR FROM date_cal) BETWEEN 2010 AND 2012

Who can help me about this!

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-09T19:55:01+00:00Added an answer on June 9, 2026 at 7:55 pm

    Your problem is a lack of brackets: In SQL AND takes precedence over OR, so you need to put brackets around your whole previous expression:

    SELECT * FROM dim_date
    WHERE ( -- added bracket
     EXTRACT (MONTH FROM date_cal) BETWEEN 3 AND 5
     OR (EXTRACT (MONTH FROM date_cal) = 2 AND EXTRACT (DAY FROM date_cal) >= 15)
     OR (EXTRACT (MONTH FROM date_cal) = 6 AND EXTRACT (DAY FROM date_cal) <= 21)
     ) -- added bracket
    AND EXTRACT (YEAR FROM date_cal) BETWEEN 2010 AND 2012
    

    Without the brackets, you get A or B or (C and D), but you want (A or B or C) and D

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I can get data from MySql with use of php using android successfully. But
I can get other capybara methods like visit, fill_in, select etc.. to work. but
I can get a colored ListLinePlot by doing something like ListLinePlot[Range[420, 680, 20], ColorFunction
I can get a list of unique constraints fairly easily with the following query:
I can get the code of a stored procedure using the syscomments table. select
Can we get an ivar or a property from a NSString like we can
I can get an html code from web site this way: public void Test()
I can get user inputed name(username) with following code from a form. So my
I can get the view function from request.path : from django.core.urlresolvers import resolve view_func,
I can get a list of running threads from Process.GetCurrentProcess().Threads, but I need to

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.