SunQuest
           Database Management
 
Forums: » Register « |  User CP |  Games |  Calendar |  Members |  FAQs |  Sitemap |  Support | 
User Name:
Password:
Remember me
Go Back   Dev Shed ForumsDatabasesDatabase Management

Reply
Add This Thread To:
  Del.icio.us   Digg   Google   Spurl   Blink   Furl   Simpy   Y! MyWeb 
Thread Tools Search this Thread Rate Thread Display Modes
 
Unread Dev Shed Forums Sponsor:
Get inside! Sample the range of functionality easily built with JMSL Library for Time Series Data Analysis, Heat Maps, Portfolio Optimization, Monte Carlo Simulation, Stock Price Charting and more. Download Now!
  #1  
Old July 10th, 2003, 03:13 PM
delatush delatush is offline
Junior Member
Dev Shed Newbie (0 - 499 posts)
 
Join Date: Jul 2003
Posts: 2 delatush User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: < 1 sec
Reputation Power: 0
query for you experts, is it possible?

What I am trying to do sounds very simple, yet has been very annoying at the same time.

My tbl [signups], has a column [users], and [signupdate]
[users] are unique IDs, and [signupdate] is in datetime format.

What would be the easiest most efficient way to return how
many people signed up per hour?
IE.

hour signupCount
0 4
1 3
2 1
3 1

ect,,,,,,,,,


I have it working w/ loops and a temp tbl, just wondering if there is an easier way

thanks!

Reply With Quote
  #2  
Old July 10th, 2003, 03:48 PM
bcyde's Avatar
bcyde bcyde is offline
Me likey breadsticks...
Dev Shed Beginner (1000 - 1499 posts)
 
Join Date: Jan 2003
Location: Los Angeles
Posts: 1,189 bcyde User rank is Sergeant (500 - 2000 Reputation Level)bcyde User rank is Sergeant (500 - 2000 Reputation Level)bcyde User rank is Sergeant (500 - 2000 Reputation Level)bcyde User rank is Sergeant (500 - 2000 Reputation Level)bcyde User rank is Sergeant (500 - 2000 Reputation Level) 
Time spent in forums: 3 Days 1 h 12 m 57 sec
Reputation Power: 12
Send a message via AIM to bcyde Send a message via Yahoo to bcyde
What DB are you using?

If it was in Postgres I'd use the to_char function on the timestamp to extract the specific date/hour and group by that.

For example (*note untested code)

SELECT count(users) AS count, to_char(signupdate, 'MM-DD-YYYY HH24') AS date GROUP BY date .

HTH,

-b
__________________
PostgreSQL, it's what's for dinner...

Reply With Quote
  #3  
Old July 17th, 2003, 08:36 AM
delatush delatush is offline
Junior Member
Dev Shed Newbie (0 - 499 posts)
 
Join Date: Jul 2003
Posts: 2 delatush User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: < 1 sec
Reputation Power: 0
FOUND ANSWER

Thanks for the Suggestion, but I found what I was try to accomplish which is :


SELECT CONVERT(VARCHAR(32), signupDate, 101) theDate, DATEPART(hh, signupDate) SignUpHour, COUNT(*) HourCount

FROM memberSignups
WHERE signupDate >= '2003-07-01' AND signup_date < '2003-07-02'
GROUP BY CONVERT(VARCHAR(32), signupDate, 101), DATEPART(hh, signupDate)

Reply With Quote
Reply

Viewing: Dev Shed ForumsDatabasesDatabase Management > query for you experts, is it possible?


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 4 hosted by Hostway