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

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 24th, 2005, 04:22 AM
rudivoller rudivoller is offline
Registered User
ASP Free Newbie (0 - 499 posts)
 
Join Date: Mar 2005
Posts: 1 rudivoller User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: 4 m 4 sec
Reputation Power: 0
SQL group by

Two tables: tableTournament, tablePlayerDetails

In tableTournament are, among other fields, intPlayerID, intRanking and intMoney.

For each tournament a player gets ranking points and money.

In tablePlayers I've got strPfirstname and strPsurname.

I want to create a ranking list that aggregates intRanking and intMoney and shows the playername.

I've tested the following but it does not work:

SQLrank = "SELECT tableTournament.intPlayerID,SUM(tableTournament.in tRanking), SUM(tableTournament.intMoney)," & _
"tablePlayerDetails.strPfirstname,tablePlayerDetail s.strPsurname FROM tableTournament,tablePlayerdetails " & _
"GROUP BY tableTournament.intPlayerID HAVING tableTournament.intPlayerID=tablePlayerDetails.Pla yerID ORDER BY tableTournament.intRanking DESC"

Error message:

Microsoft JET Database Engine error '80040e21'

You tried to execute a query that does not include the specified expression 'strPfirstname' as part of an aggregate function.

Any ideas?

Reply With Quote
  #2  
Old March 24th, 2005, 07:14 AM
mvagh2 mvagh2 is offline
Contributing User
ASP Free Newbie (0 - 499 posts)
 
Join Date: Feb 2005
Posts: 324 mvagh2 User rank is Corporal (100 - 500 Reputation Level)mvagh2 User rank is Corporal (100 - 500 Reputation Level)mvagh2 User rank is Corporal (100 - 500 Reputation Level)mvagh2 User rank is Corporal (100 - 500 Reputation Level) 
Time spent in forums: 2 Days 16 h 26 m 36 sec
Reputation Power: 5
Hi,

Try this: -

Code:
SELECT tableTournament.intPlayerID, tablePlayerdetails.strPfirstname, tablePlayerdetails.strPsurname, Sum(tableTournament.IntRanking) AS SomVanIntRanking, Sum(tableTournament.intMoney) AS SomVanintMoney
  FROM tableTournament HAVING  tableTournament.intPlayerID = tablePlayerdetails.IntPlayerID
 GROUP BY tableTournament.intPlayerID, tablePlayerdetails.strPfirstname, tablePlayerdetails.strPsurname, tableTournament.IntRanking
  ORDER BY tableTournament.IntRanking DESC;



Regards,

Michiel

Reply With Quote
Reply

Viewing: ASP Free ForumsDatabaseSQL Development > SQL 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



 Free IT White Papers!
 
How to Present Effectively Online
This white paper offers practical and actionable advice on the key steps that any presenter should consider as they plan and execute a Webinar or online meeting.

 
Open Source Security Myths
Open Source Software (OSS) is computer software whose source code is available to the general public with relaxed or non-existent intellectual property restrictions (or arrangement such as the public domain), and is usually developed with the input of many contributors.

 
Power and Cooling Capacity Management for Data Centers
This paper describes the principles for achieving power and cooling capacity management.

 
Scalable, Fault-Tolerant NAS for Oracle - The Next Generation
For several years NAS has been evolving as a storage alternative for Oracle databases, and for good reason: NAS is quite often the simplest, most cost-effective storage approach for Oracle. Learn about the benefits that HP's approach to scalable NAS brings to Oracle environments in this comprehensive white paper.

 
Understanding Web Application Security Challenges
This white paper discusses many common threats and preventive measures for Web application security, and explains what you can do to help protect your organization.

 

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





© 2003-2009 by Developer Shed. All rights reserved. DS Cluster 6 hosted by Hostway
Stay green...Green IT