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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 15, 20262026-06-15T02:45:45+00:00 2026-06-15T02:45:45+00:00

I have this query that I’m using to pull records from my DB: SELECT

  • 0

I have this query that I’m using to pull records from my DB:

SELECT dateAdded, claimedDate, TIMESTAMPDIFF(SECOND, dateAdded, claimedDate) AS output FROM leads 
WHERE HOUR(dateAdded) >= '9' 
AND HOUR(dateAdded) < '18' 
AND DAYOFWEEK(dateAdded) != 7 
AND DAYOFWEEK(dateAdded) != 1

As it stands, I’m currently only selecting records with a timestamp that falls between 9:00am – 5:00pm, Monday through Friday. I also need to be able to exclude the following major holidays: New Year’s Day, Memorial Day, Independence Day, Labor Day, Thanksgiving, and Christmas.

I need those holidays excluded for all time. For example, the query should exclude all records that occur on the fourth Thursday of Nov (Thanksgiving), regardless of the year.

This doesn’t necessarily need a MySQL-only solution. If it’s easier to do a hybrid PHP/MySQL solution that would also work great. Thanks for the help.

  • 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-15T02:45:46+00:00Added an answer on June 15, 2026 at 2:45 am

    You need a table of dates that meet your “holiday” criteria, and then you JOIN to that table.

    Here’s an example

    Otherwise, you’ll need to simply exclude them…

    ... WHERE dateAdded NOT IN ('2012-07-04', ...)
    

    Update

    This solution uses a JOIN to omit holidays.

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

Sidebar

Related Questions

So I have this query that works perfectly: SELECT users.*, GROUP_CONCAT(categories.category_name) AS categories FROM
I have this query that runs fine: SELECT Value FROM data WHERE MetaDataID =
I have this query that is taking information from two different databases: I'm using
I have this query that spawns the following error: SELECT * FROM Quota WHERE
I have this query that works: select name, location_id from all_names where location_id in
i have this query that works fine SELECT t.username FROM users t LEFT JOIN
I have this MySQL query that I'd like to optimize: SELECT min(`topic_id`) FROM `gallery_topics`
I have this query that I'm running in Java. select book from com where
I have this query: Select * From Player_Chkin_Cs That spits out the result: Player_ID
I have this query that, due to the number of records, is taking several

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.