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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 28, 20262026-05-28T05:46:28+00:00 2026-05-28T05:46:28+00:00

i am new at sqlserver and i just started learning it , and i

  • 0

i am new at sqlserver and i just started learning it , and i have a question .
**i want an SQL query that can bring up all rows that were added in the past 6 months. in table ‘users’ the date is in field ‘joined’ but its in UNIX time stamp format

**and i want then like another SQL query the same as above but it also with the results sets the field ‘activate’ in each row to ‘yes’

i tried that code :

select * from users where time_of_post is like '07/**/2011'

** = anyday but i can`t implement it right .

Thank you a lot for your help 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-28T05:46:29+00:00Added an answer on May 28, 2026 at 5:46 am
    select *
    from users
    where datediff(mm, time_of_post, getdate()) <= 6
    

    What you want to use is the DATEDIFF() function, and get the difference between today’s day (GETDATE()) and the stored dates (time_of_post). If that is less than or equal to 6 months (as denoted by the first parameter, mm) then that should be what you’re looking for.

    EDIT:

    If you’re looking to use this logic for an UPDATE, you’d do something like this:

    update users
    set activation = 'yes'
    where datediff(mm, time_of_post, getdate()) <= 6
    and activation <> 'yes'
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I just started using the new project type SQL Server 2008 Database. I can
I have just started a new web application with asp.net mvc and sql server
I am a seasoned .NET / SQL Server developer. I just started a new
So I am just getting started with this. New to .NET, SQL Server, C#,
I've just started a new job where I'm going to have to do a
I just started at a new company and I'm responsible for the reporting sql
I've just started to use linq to sql and have run into a problem
I've recently started creating a WPF application, and am just hoping that someone can
Question: The new SQL Server 2008 database returns me values formatted English (date/float). Is
I need to create an entirely new Sql Server 2008 database and want 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.