troubleshooting Question

mysql join help

Avatar of Dan560
Dan560Flag for United Kingdom of Great Britain and Northern Ireland asked on
MySQL Server
6 Comments1 Solution288 ViewsLast Modified:
Hi,

I am trying to build a report that displays all helpdesk calls logged in the last 30 days. The problem I have is that if a call is not logged on a day then there is blank in my report which looks messy.

So what I have done is created a table of dates from 2010-01-01 to 2030-01-01

I want to join these dates to my real table of dates. I am using the following mysql statement but it is not showing me the missing dates as expected.

datestable.date being the table with my dates
mytable being where the data is stored from my helpdesk.

Select  mytable.*,datestable.dates
from datestable LEFT JOIN mytable ON datestable.date = FROM_UNIXTIME(logdatex,"%Y-%d-%m")
WHERE datestable.date BETWEEN CURDATE() - INTERVAL 30 DAY AND CURDATE()
Join the community to see this answer!
Join our exclusive community to see this answer & millions of others.
Unlock 1 Answer and 6 Comments.
Join the Community
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 6 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