troubleshooting Question

MySql - can I create a Calculated Field and index it?

Avatar of Daniel Wilson
Daniel WilsonFlag for United States of America asked on
MySQL ServerMicrosoft SQL Server
10 Comments1 Solution423 ViewsLast Modified:
I have a WHERE clause that looks like:
WHERE Month(PA.EntryDate) = Month('11-10-04') and Year(PA.EntryDate) = Year('11-10-04')

Something like that shows up a lot in my DB.

I would like to add a column
EntryMonth as Month(EntryDate) -- or something to that effect.  In MS SQL Server, that would allow me to index the EntryMonth so that an index could be used in the WHERE clause.

Can I do something similar in MySql?  Every Google search I try on Calculated Fields is coming up with fields updated by a trigger ... not a true calculated field.  Is that the best MySql 5 can offer currently?

Thanks!
ASKER CERTIFIED SOLUTION
ralmada

Our community of experts have been thoroughly vetted for their expertise and industry experience.

Join our community to see this answer!
Unlock 1 Answer and 10 Comments.
Start Free Trial
Learn from the best

Network and collaborate with thousands of CTOs, CISOs, and IT Pros rooting for you and your success.

Andrew Hancock - VMware vExpert
See if this solution works for you by signing up for a 7 day free trial.
Unlock 1 Answer and 10 Comments.
Try for 7 days

”The time we save is the biggest benefit of E-E to our team. What could take multiple guys 2 hours or more each to find is accessed in around 15 minutes on Experts Exchange.

-Mike Kapnisakis, Warner Bros