Wrox Programmer Forums
|
Access Discussion of Microsoft Access database design and programming. See also the forums for Access ASP and Access VBA.
Welcome to the p2p.wrox.com Forums.

You are currently viewing the Access section of the Wrox Programmer to Programmer discussions. This is a community of software programmers and website developers including Wrox book authors and readers. New member registration was closed in 2019. New posts were shut off and the site was archived into this static format as of October 1, 2020. If you require technical support for a Wrox book please contact http://hub.wiley.com
 
Old June 20th, 2006, 12:04 PM
Friend of Wrox
 
Join Date: Dec 2005
Posts: 142
Thanks: 0
Thanked 0 Times in 0 Posts
Default

Hm, tricky query there.. but I think something like this might work:

SELECT Team.HomeName, SUM(IIf(Team.HomeId = Games.HomeId, Games.HomeScore, Games.AwayScore))
FROM (Games LEFT JOIN Team ON (Games.HomeId = Team.HomeId OR Games.AwayId = Team.AwayId)) LEFT JOIN Schedule ON (Games.DateId = Schedule.DateId)
WHERE Schedule.ScheduleDate <= #4/30/2006# AND Schedule.ScheduleDate >= #4/1/2006#;

 
Old June 20th, 2006, 05:49 PM
Registered User
 
Join Date: Jun 2006
Posts: 6
Thanks: 0
Thanked 0 Times in 0 Posts
Default

I tried the example kindler and I get Microsoft Access message

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

I got the same message when I use the Month function.

 
Old June 21st, 2006, 01:42 AM
Friend of Wrox
 
Join Date: Dec 2005
Posts: 233
Thanks: 0
Thanked 0 Times in 0 Posts
Send a message via MSN to anukagni Send a message via Yahoo to anukagni
Default

Hi,Surfer

  why con't u try with sample database "Northwind sample" because i tried lots of think and i got the remedies



bye
------------------------
pap...
 
Old June 21st, 2006, 12:29 PM
Friend of Wrox
 
Join Date: Dec 2005
Posts: 142
Thanks: 0
Thanked 0 Times in 0 Posts
Default

Oops! I forgot a line there, knew it looked a little bit off. Try this:

SELECT Team.HomeName, SUM(IIf(Team.HomeId = Games.HomeId, Games.HomeScore, Games.AwayScore))
FROM (Games LEFT JOIN Team ON (Games.HomeId = Team.HomeId OR Games.AwayId = Team.AwayId)) LEFT JOIN Schedule ON (Games.DateId = Schedule.DateId)
WHERE Schedule.ScheduleDate <= #4/30/2006# AND Schedule.ScheduleDate >= #4/1/2006#
GROUP BY Team.HomeName;






Similar Threads
Thread Thread Starter Forum Replies Last Post
Problem to restore database in C#2005 database acmuralee MySQL 0 March 25th, 2008 04:42 AM
Microsoft JET Database Database Engine (0x80040E09 cannielynn0312 Classic ASP Professional 2 December 17th, 2007 02:50 AM
Copying Table From one Database To Anoter Database jayanth_nadig VB Databases Basics 1 June 19th, 2006 02:39 PM
Desing Pattern tilakkalyan J2EE 3 February 14th, 2006 07:04 AM





Powered by vBulletin®
Copyright ©2000 - 2020, Jelsoft Enterprises Ltd.
Copyright (c) 2020 John Wiley & Sons, Inc.