Microsoft SQL Server
 
Forums: » Register « |  User CP |  Games |  Calendar |  Members |  FAQs |  Sitemap |  Support | 
 
 
User Name:
Password:
Remember me
Go Back   ASP Free ForumsDatabaseMicrosoft SQL Server

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 ASP Free Forums Sponsor:
  #1  
Old March 15th, 2005, 02:30 AM
vickr11z vickr11z is offline
Registered User
ASP Free Newbie (0 - 499 posts)
 
Join Date: Mar 2005
Posts: 4 vickr11z User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: 3 h 55 m 32 sec
Reputation Power: 0
Timestamp computation

good day to all.

im newbie to sql. i want to achieve to compute for Average of encoder speed input.
i have this two table name cocv_2004 and with the ff columns;
-- cocv_id
-- personality_id
-- province_code
-- municipality_code
-- votes
-- db_user
-- timestamp


and

table name cc_encodersee with columns:
-- cc_encodersee_id
-- cc_id
-- polparty_id
-- db_user
-- timestamp

can anyone help me how to select out from this table of an avegare speed output refering from timestamp column? id like it to have a select only on columns cc_encodersee_id, db_user, and timestamp(for average speed computation).

is there a way to compute time in sql queries function? can u give me with this example.? thanks in advance..

Reply With Quote
  #2  
Old March 15th, 2005, 10:46 AM
Memnoch's Avatar
Memnoch Memnoch is offline
Unholy Moderator
Click here for more information.
 
Join Date: Oct 2003
Location: In hell, where did you think?
Posts: 11,781 Memnoch User rank is Lieutenant Colonel (40000 - 50000 Reputation Level)Memnoch User rank is Lieutenant Colonel (40000 - 50000 Reputation Level)Memnoch User rank is Lieutenant Colonel (40000 - 50000 Reputation Level)Memnoch User rank is Lieutenant Colonel (40000 - 50000 Reputation Level)Memnoch User rank is Lieutenant Colonel (40000 - 50000 Reputation Level)Memnoch User rank is Lieutenant Colonel (40000 - 50000 Reputation Level)Memnoch User rank is Lieutenant Colonel (40000 - 50000 Reputation Level)Memnoch User rank is Lieutenant Colonel (40000 - 50000 Reputation Level)Memnoch User rank is Lieutenant Colonel (40000 - 50000 Reputation Level)Memnoch User rank is Lieutenant Colonel (40000 - 50000 Reputation Level)Memnoch User rank is Lieutenant Colonel (40000 - 50000 Reputation Level) 
Time spent in forums: 3 Weeks 5 Days 8 h 45 m 55 sec
Reputation Power: 470
Have you tried something like this?
Code:
SELECT AVG(TimeStampField)
FROM Table

Reply With Quote
  #3  
Old March 16th, 2005, 02:14 AM
vickr11z vickr11z is offline
Registered User
ASP Free Newbie (0 - 499 posts)
 
Join Date: Mar 2005
Posts: 4 vickr11z User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: 3 h 55 m 32 sec
Reputation Power: 0
Unhappy

Quote:
Originally Posted by Memnoch
Have you tried something like this?
Code:
   SELECT AVG(TimeStampField)
   FROM Table
   


yes i tried that query but it gives me an error:

Code:
ERROR:  Function avg(timestamps) does not exist
   	Unable to identify a function that satisfies the given argument types
   	You may need to add explicit typecasts


this is the actual SQL that i used.
Code:
SELECT AVG(timestamp) AS average, db_user
 FROM cc_endorsee
 GROUP BY db_user;


and BTW im using PostgresQL 7.3.2 i hope thats not the issue.

How can i solve this? thanks again for help!

Reply With Quote
  #4  
Old March 16th, 2005, 09:15 AM
Memnoch's Avatar
Memnoch Memnoch is offline
Unholy Moderator
Click here for more information.
 
Join Date: Oct 2003
Location: In hell, where did you think?
Posts: 11,781 Memnoch User rank is Lieutenant Colonel (40000 - 50000 Reputation Level)Memnoch User rank is Lieutenant Colonel (40000 - 50000 Reputation Level)Memnoch User rank is Lieutenant Colonel (40000 - 50000 Reputation Level)Memnoch User rank is Lieutenant Colonel (40000 - 50000 Reputation Level)Memnoch User rank is Lieutenant Colonel (40000 - 50000 Reputation Level)Memnoch User rank is Lieutenant Colonel (40000 - 50000 Reputation Level)Memnoch User rank is Lieutenant Colonel (40000 - 50000 Reputation Level)Memnoch User rank is Lieutenant Colonel (40000 - 50000 Reputation Level)Memnoch User rank is Lieutenant Colonel (40000 - 50000 Reputation Level)Memnoch User rank is Lieutenant Colonel (40000 - 50000 Reputation Level)Memnoch User rank is Lieutenant Colonel (40000 - 50000 Reputation Level) 
Time spent in forums: 3 Weeks 5 Days 8 h 45 m 55 sec
Reputation Power: 470
Quote:
Originally Posted by vickr11z
and BTW im using PostgresQL 7.3.2 i hope thats not the issue.

Well, it is when your posting the question in the SQL Server forum without even mentioning it in your initial post.

One (I) would automatically assume you were using SQL Server.

Reply With Quote
Reply

Viewing: ASP Free ForumsDatabaseMicrosoft SQL Server > Timestamp computation


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 1 hosted by Hostway
Stay green...Green IT