SunQuest
 
           MySQL Development
 
Forums: » Register « |  User CP |  Games |  Calendar |  Members |  FAQs |  Sitemap |  Support | 
 
User Name:
Password:
Remember me
 
Go Back   Dev Articles Community ForumsDatabasesMySQL Development

Reply
Add This Thread To:
  Del.icio.us   Digg   Google   Spurl   Blink   Furl   Simpy   Y! MyWeb 
Thread Tools Search this Thread Display Modes
 
Unread Dev Articles Community Forums Sponsor:
Stay one step ahead of the competition. Evaluate and give feedback on some of the hottest web development tools on the market today. Make your opinion heard! Click Here
  #1  
Old March 27th, 2005, 09:51 PM
arisudradjat arisudradjat is offline
Registered User
Dev Articles Newbie (0 - 499 posts)
 
Join Date: Mar 2005
Posts: 1 arisudradjat User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: 11 m 40 sec
Reputation Power: 0
Question How can I get date in "group by" ?

Hi all,

I want to "group by" my table based on date. here my table look like :

| date | id | total |
| 2005-01-01 | 1 | 12 |
| 2005-01-01 | 2 | 10 |
| 2005-01-01 | 3 | 13 |
| 2005-01-03 | 4 | 14 |
| 2005-01-03 | 5 | 14 |
| 2005-01-03 | 6 | 15 |
| 2005-01-04 | 7 | 12 |
| 2005-01-04 | 8 | 11 |
| 2005-01-04 | 9 | 10 |

I want to show the "total" every day using "group by". I can do that easily with "group by", but the problem is I don't see the "2005-01-02" date on my result (since there were no data at that day)

so..... is there a way for me to see the missing day ? If there were no data, I would like to see the missing day but fill the result with 0. so the result I want is :

| date | day_total |
| 2005-01-01 | 35 |
| 2005-01-02 | 0 |
| 2005-01-03 | 43 |
| 2005-01-04 | 33 |

Please help me, this is very important to me .


Ari

Reply With Quote
  #2  
Old March 28th, 2005, 08:16 AM
Anibal Anibal is offline
Contributing User
Dev Articles Newbie (0 - 499 posts)
 
Join Date: Jan 2005
Posts: 176 Anibal User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: 1 Day 4 h 20 m 48 sec
Reputation Power: 4
Hey Ari!

I'm not sure, but you could try this:

SELECT IsNull(count(total), 0) FROM .........GROUP BY date

I don't see this happening, but you could give it a shot!!

Good Luck!

ANibal.

Reply With Quote
Reply

Viewing: Dev Articles Community ForumsDatabasesMySQL Development > How can I get date in "group by" ?


Thread Tools  Search this Thread 
Search this Thread:

Advanced Search
Display Modes  Rate This Thread 
Rate This Thread:


Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is On
HTML code is Off
View Your Warnings | New Posts | Latest News | Latest Threads | Shoutbox
Forum Jump


Forums: » Register « |  User CP |  Games |  Calendar |  Members |  FAQs |  Sitemap |  Support | 
  
 





© 2003-2008 by Developer Shed. All rights reserved. DS Cluster 2 hosted by Hostway