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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 7, 20262026-06-07T15:25:00+00:00 2026-06-07T15:25:00+00:00

I posted another question which was resolved perfectly however I now need to apply

  • 0

I posted another question which was resolved perfectly however I now need to apply the same code I was given to a different piece of MySQL code.

What I have is

SELECT value, COUNT(*) AS 'num' 
FROM table_c 
WHERE table_c_id IN (9, 17, 25)
GROUP BY value

What I would like to do now is only show the results if they have been entered on the current date?

The current code snippet I have for checking the current date, which works great is (the date is in unixtime format)

( xxxxxxxxxxxxxx and curdate() = date( from_unixtime( b.crm_date_time_column ) ) )

The problem I have with query this is the date column is located in a totally different table, table_a.

How do I write the MySQL to check table_a for the date and apply the existing date SQL I have?

This is a MySQL database.

Any help will be gratefully received! This is way over my head!

  • 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-07T15:25:03+00:00Added an answer on June 7, 2026 at 3:25 pm

    You’ll want to first JOIN the other table onto the first using related columns (I’m assuming id in the other table is related to table_c_id).

    And as I had stated in my answer to your previous question, you’re better off making the comparison on the bare datetime column so that the query remains sargable(i.e. able to utilize indexes):

    SELECT     a.value
    FROM       table_c a
    INNER JOIN table_a b ON a.table_c_id = b.id
    WHERE      a.table_c_id IN (9,17,25) AND
               b.crm_date_time_column >= UNIX_TIMESTAMP(CURDATE())
    GROUP BY   a.value 
    

    This assumes the crm_date_time_column will never contain times which are in the future (e.g. tomorrow, next month, etc.), but if it can, you would just add:

    AND b.crm_date_time_column < UNIX_TIMESTAMP(CURDATE() + INTERVAL 1 DAY)
    

    as another condition in the WHERE clause.

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

Sidebar

Related Questions

I have recently posted another question which straight away users pointed me in the
In a previous question I posted (which contains all the code) Unable to substantiate
I posted an answer to another stackoverflow question which requires some digital logic to
I followed the question previously posted here I need to do pretty much same,
From another question I recently posted, it seems that Classic ASP might not be
In another question, a user posted the following reflog: 8c48bab HEAD@{16}: checkout: moving from
This question is related to another question I just posted . I'm prepping for
An answer posted for one of my previous questions brings up another question; I
Following on from a question I posted yesterday about GUIs, I have another problem
I posted a related but still different question regarding Protobuf-Net before, so here goes:

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.