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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 8, 20262026-06-08T01:33:06+00:00 2026-06-08T01:33:06+00:00

hi guys i am really new to sql so please be gentle with me

  • 0

hi guys i am really new to sql so please be gentle with me on this one. i am trying to run a Query that will pull all records that have been either created_at or updated_at within the last two weeks.

i did some reading at this is what i have so far

SELECT * FROM sms_development.scores WHERE DATE(created_at) = CURDATE() - INTERVAL 14 DAY AND CURDATE() OR DATE(updated_at) = CURDATE() - INTERVAL 14 DAY AND CURDATE();

this looks really huge and its not dry at all. and its not working for some reason. if i enter it into MySQL workbench it give me a green light but i dont know if i have made a gramatical error or something. but no records are pulled.

any advice or techniques that are helpful are much 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-06-08T01:33:09+00:00Added an answer on June 8, 2026 at 1:33 am

    You should probably do as much of this through Rails finders as possible; they’re at least partially portable to other data storage engines, so if you, say, switch from SQLite to Postgres you won’t have to rewrite (as much) code.

    I would do this like so:

    Score.where('created_at > ? OR updated_at > ?', DateTime.now - 2.weeks, DateTime.now - 2.weeks).all
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

Alright guys, I really hurt my brain over this one and I'm curious if
hey guys, this might be really stupid, but hopefully someone can help. I'm trying
Hi guys this will be my first post and am pretty new to Objective-C
One time that I had a prob, you guys were really helpful. So here
Ok guys, I'm really new at python (and programming itself) so sorry for my
hey guys having this really simple problem but cant seem to figure out have
This might be a really stupid question and make you guys laugh. I've deployed
Ok guys, I know this is pretty a rare case but I really would
Hey guys really quick question, I have a simple test that I was doing
I'm new to jQuery, I was hoping you guys could help me. I'm trying

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.