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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 18, 20262026-05-18T07:16:40+00:00 2026-05-18T07:16:40+00:00

I have indexes on tbl1.date and tbl2.datetime. When I do the following: EXPLAIN SELECT

  • 0

I have indexes on tbl1.date and tbl2.datetime. When I do the following:

EXPLAIN SELECT * FROM tbl1 LEFT JOIN tbl2 ON tbl2.datetime = tbl1.date

tbl2.datetime index gets used (as expected)

Obviously, I need to convert tbl2.datetime to a date in order for the SELECT statement to work in real life. However, doing so results in none of the indexes getting used:

EXPLAIN SELECT * FROM tbl1 LEFT JOIN tbl2 ON DATE(tbl2.date) = tbl1.date

What am I missing?

UPDATE:
I’ve tried something like this but keep getting syntax error

“#1064…. check the manual that corresponds to your MySQL server version for the right syntax to use near ‘SELECT * FROM tbl1 LEFT JOIN tbl2 ON DATE( SELECT * FROM (SELECT DISTINCT datetime FROM tbl2.datetime) as tem’ at line 1”

EXPLAIN SELECT * FROM tbl1 LEFT JOIN tbl2 ON DATE( SELECT * FROM (SELECT DISTINCT          
datetime FROM tbl2.datetime) as tempTable ) = quotes.GOOG.date
  • 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-18T07:16:40+00:00Added an answer on May 18, 2026 at 7:16 am

    What am I missing?

    Nothing – you can’t alter the data or data type and expect to be able to use the index.

    While being altered for the comparison, there’s no link between the value in the index and the value you want/need to use. The only option is to store the value in a way that doesn’t require the alteration if you want to see an index get used.

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

Sidebar

Related Questions

I have the following MySql query: select t1.* from Table1 t1 inner join Table2
The query: SELECT tbl1.* FROM tbl1 JOIN tbl2 ON (tbl1.t1_pk = tbl2.t2_fk_t1_pk AND tbl2.t2_strt_dt
Which Tables and columns should have indexes? I have an index on flow_permanent_id and
I have the following query which obtains transactions from the transactions table and transaction
SELECT nar.name, nar.reg, stat.lvl FROM members AS nar JOIN stats AS stat ON stat.id
I run the following query on my database : SELECT e.id_dernier_fichier FROM Enfants e
I have a database with the following stats Tables Data Index Total 11 579,6
I have 3 tables t1,t2,t3 each having 35K records. select t1.col1,t2.col2,t3.col3 from table1 t1,table2
I have the following Query and i need the query to fetch data from
The consensus seems to be that all foreign keys need to have indexes. How

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.