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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 28, 20262026-05-28T16:21:06+00:00 2026-05-28T16:21:06+00:00

need your help. I tried myself but cant solve it. I have a table

  • 0

need your help. I tried myself but cant solve it.

I have a table with date column (ex. birth) So i need to select all rows where birth is in past more than one months.

I googled and found a SO question similar
The difference in months between dates in MySQL

But there is no a condition by this new period. My wrong query is:

select id,period_diff(date_format(now(), "%Y%m"), date_format(birth, "%Y%m")) as months 
from t1
where months>0 
limit 10
  • 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-28T16:21:08+00:00Added an answer on May 28, 2026 at 4:21 pm

    Try Below:

    use having (ALIAS months in WHERE Clause not working here)

    select id,period_diff(date_format(now(), "%Y%m"), date_format(birth, "%Y%m")) as months 
    from t1
    having months>0 
    limit 10
    

    HAVING is like WHERE but it is able to work on columns which are computed (Alias). HAVING works by pruning results after the rest of the query has been run – it is not a substitute for the WHERE clause.

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

Sidebar

Related Questions

Guys Need your help. I have a shadow applied to Div thru CSS, but
i have never tried something like this so i need your help. i have
i need your help in access db i have a table like this ID
That might sound silly but can't do it myself :( Need your help guys.
I need your help :) I have a table in a database (SQL Server
I really need your help. I tried everything but the result is always the
I need your help, For example I have a decimal type variable and I
I've some questions .. and I really need your help. I have an application.
ive being trying to cope with this problem but still. I need your help.
i really need your help with a CSS-Layout. I tried a few time, however

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.