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 6233191
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 24, 20262026-05-24T10:15:13+00:00 2026-05-24T10:15:13+00:00

I have this on my WHERE clause dob <= DATE_SUB(CURDATE(),INTERVAL 1 YEAR) AND dob

  • 0

I have this on my WHERE clause

dob <= DATE_SUB(CURDATE(),INTERVAL 1 YEAR) AND dob >= DATE_SUB(CURDATE(),INTERVAL 19 YEAR) 

It works alright,it searches a persons by age based on their DOB,
however there is some precision issues.

Consider the following:

1 to 19                                 =             397
20-25                                   =            1350
26- 30                                  =            1139
31-35                                   =             601
36-40                                   =             346
41-45                                   =             218
46- 50                                  =             154
51-55                                   =             139
56-60                                   =              65
61-85                                   =              78      Total = 4487

If I use the same method but search for 1 – 85 return 5607

I am puzzled but then again dates are my weakness so any help would be appreciated.

  • 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-05-24T10:15:14+00:00Added an answer on May 24, 2026 at 10:15 am

    Oh, I think when you do DATE_SUB(CURDATE(),INTERVAL 19 YEAR) and then DATE_SUB(CURDATE(),INTERVAL 20 YEAR)

    You miss people in there 19th years, so you’re missing the people in there 19th, 26th, 30th, 35th … etc

    It should be
    dob < DATE_SUB(CURDATE(),INTERVAL 1 YEAR) AND dob >= DATE_SUB(CURDATE(),INTERVAL 19 YEAR)

    And then
    dob < DATE_SUB(CURDATE(),INTERVAL 19 YEAR) AND dob >= DATE_SUB(CURDATE(),INTERVAL 25 YEAR)

    edit :

     1  to 19                                   =            ??
     19 to 25                                   =            ??
     25 to 30                                   =            ??
     30 to 35                                   =            ??
     35 to 40                                   =            ??
     40 to 45                                   =            ??
     45 to 50                                   =            ??
     50 to 55                                   =            ?? 
     55 to 60                                   =            ??
     60 to 85                                   =            ??`
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

So I have this linq query clause. var ctx = new Context(); IQueryable<Users> consulta
I have a problem with an SQL query on Postgresql. This select clause is
i have the following if-clause: if(empty($var)){ $errors[]=Failure; } this is for a form that
I have a query that uses a where clause. At times, this may be
i have created this query that works OK: $q1 = Doctrine_Query::create() ->from('Usuario u') ->leftJoin('u.AmigoUsuario
I used to have this clause in my AndroidManifest.xml : <uses-configuration android:reqFiveWayNav=false android:reqHardKeyboard=false android:reqKeyboardType=nokeys
I have this clause: SELECT * FROM picture p WHERE p.id IN (2, 1,
I have this SQL that works fine although a little slow. Ideally would like
I have this clause on a join in a stored procedure I inherited: WHERE
I have this query which is pretty long, but adding a where clause 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.