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

  • Home
  • SEARCH
  • 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 6902395
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 27, 20262026-05-27T07:47:34+00:00 2026-05-27T07:47:34+00:00

I have a table in mySQL: —Dogs— id int birthdate date On average, a

  • 0

I have a table in mySQL:

---Dogs---
id        int
birthdate date

On average, a dog adds 7 years to its life, every year.
Basically I would like to know if today is the dog’s actual birthday or if it’s their dog birthday. It’s approximately 52 days between each dog birthday. I can’t figure out how to write this query at all.

I would like rows returned that would look like this:

|-----------------|
| id | birthdate  |
|-----------------|
| 40 | 2003-12-08 |
| 59 | 2007-12-08 |
| 87 | 2005-06-07 | <- 
| 33 | 2009-11-05 | <- Not sure if these would be accurate but want them to
|    |            |    return if today worked out being their 'dog birthday'

Also, their actual birthdate is much more important to me. I don’t want to rely on a date_diff calculation. Where birthdate = today OR birthdate = calculated date.

I think I peiced it together. I did this and it seems to be working the way I want:

select distinct(d.id) from Dogs d
where MONTH( CURDATE( ) ) = MONTH( d.birthdate  )
AND DAYOFMONTH( CURDATE( ) ) = DAYOFMONTH( d.birthdate )
or
datediff (curdate(), d.birthdate) % 52 = 0
  • 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-27T07:47:34+00:00Added an answer on May 27, 2026 at 7:47 am

    Use modulus :-

    select id
    from Dogs
    where datediff (curdate(), birthday) %52 = 0;
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I have a table in MySQL That looks like the following: date |storenum |views
I have a table (MySQL) that captures samples every n seconds. The table has
!Modified! I have a table (mySQL 5.0.x) which contains values for date ranges. |
I have a table in mysql with a field called userId: `userId` int(20) NOT
Suppose I have a table (MySQL) like this: CREATE TABLE sessions ( session_id INT
I have mysql table with collumns like 'operation.date', 'operation.name' and etc. After fetching that
I have a table in mysql: CREATE TABLE user (id INT, name VARCHAR(250)); I
I have a table in MySQL with a date column, listing the date the
i have table question (mysql with php) which contains question,category(multiple) and subcat(multiple) its belong.
I have mysql table that has a column that stores xml as a string.

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.