vBulletin Search Engine Optimization
| |||||||
| Register | FAQ | Members List | Calendar | Search | Today's Posts | Mark Forums Read |
| ||||
| I have a table that stores performed transactions and I need to build a histogram of a number of transactions per day in the requested period. So, I made a simple query with the group by clause which returns me what I need: 2008-04-16 65456204 2008-04-17 190838546 2008-04-18 8909047 2008-04-19 9085084 2008-04-21 18221038 2008-04-22 18246184 except that there is no entry for April 20th as there were no transactions at that day. I need a query to return me zero for that day. I.e. I need uninterrupted sequence of dates. I am beating my head at this problem for the whole day and did not make much of a progress. If someone has any idea how to resolve this problem, I'll appreciate a tip greatly. Thank you, Gary |
| |||
| On Thursday 24 April 2008 12:26:09 pm Gary Greenberg wrote: > except that there is no entry for April 20th as there were no > transactions at that day. I need a query to return me zero for that day. > I.e. I need uninterrupted sequence of dates. > I am beating my head at this problem for the whole day and did not make > much of a progress. If someone has any idea how to resolve this problem, > I'll appreciate a tip greatly. Make a new list of just dates then join them both together. -- Regards, Michael Cole LPIC-1 "The man who does not read good books has no advantage over the man who can't read them. " - Mark Twain "It is our choices, Harry, that show what we truly are, far more than our abilities." — J. K. Rowling "Wear the old coat and buy the new book." — Austin Phelps "I'm not a teacher: only a fellow traveler of whom you asked the way. I pointed ahead – ahead of myself as well as you." — George Bernard Shaw |
| ||||
| Gary Greenberg schrieb: > I have a table that stores performed transactions and I need to build a > histogram of a number of transactions per day in the requested period. > So, I made a simple query with the group by clause which returns me what > I need: > 2008-04-16 65456204 > 2008-04-17 190838546 > 2008-04-18 8909047 > 2008-04-19 9085084 > 2008-04-21 18221038 > 2008-04-22 18246184 > > except that there is no entry for April 20th as there were no > transactions at that day. I need a query to return me zero for that day. > I.e. I need uninterrupted sequence of dates. > I am beating my head at this problem for the whole day and did not make > much of a progress. If someone has any idea how to resolve this problem, > I'll appreciate a tip greatly. a similar question was just answered on this list about 15 hours before your question ... http://lists.mysql.com/mysql/212457 -- Sebastian Mendel |