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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 22, 20262026-05-22T03:04:00+00:00 2026-05-22T03:04:00+00:00

HI all, i have one sql table and field for that table is id

  • 0

HI all,

i have one sql table and field for that table is

id
name
expireydate

Now i want only those record which one is expired within 45 days or 30 days.

how can i do with sql query .?
I have not much more exp with sql .

Thanks in advance,

  • 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-22T03:04:01+00:00Added an answer on May 22, 2026 at 3:04 am

    If you are using mysql then try DATEDIFF.

    for 45 days

    select * from `table` where DATEDIFF(now(),expireydate)<=45;
    

    for 30 days

    select * from `table` where DATEDIFF(now(),expireydate)<=30;
    

    In oracle - will do the trick instead of datediff and SYSDATE instead of now().[not sure]


    In sql server DateDiff is quite different you have to provide unit in which difference to be taken out from 2 dates.

    DATEDIFF(datepart,startdate,enddate)

    to get current date try one of this: CURRENT_TIMESTAMP or GETDATE() or {fn NOW()}

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

Sidebar

Related Questions

I have a SQL script that acquires table names and creates trigger for those
I have one MYSQL table. In that table there is one column name SRNO
I have some tables which all have a field named created_at , that's a
I have a few SQL Server databases (all in one server), containing their own
I have one master page which applies to all pages in this website. On
I have one hibernate sequence, that generates all sequence-numbers in my app. When I
I have one abstract class -let's say myBase. And I want all the classes
I'm learing LINQ-to-SQL right now and i have wrote a simple application that define
I have a field called PropertyValue in the UserProfile table that can contain information
I have a SQL Server table that contains users & their grades. For simplicity's

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.