A Microsoft Office (Excel, Word) forum. OfficeFrustration

If this is your first visit, be sure to check out the FAQ by clicking the link above. You may have to register before you can post: click the register link above to proceed. To start viewing messages, select the forum that you want to visit from the selection below.

Go Back   Home » OfficeFrustration forum » Microsoft Access » Running & Setting Up Queries
Site Map Home Register Authors List Search Today's Posts Mark Forums Read  

Query



 
 
Thread Tools Display Modes
  #1  
Old November 22nd, 2006, 06:23 AM posted to microsoft.public.access.queries
Paid The Umpire
external usenet poster
 
Posts: 5
Default Query

Quick question, I've got the below SQl statement which works well,
except I want the "CountOfOuts" to count all the values in the table
except those which have the value "NO" in it.

Is there a simple way?



SELECT DISTINCTROW MatchDetails.PlayerName,
Count(MatchDetails.Position) AS Innings, Count(MatchDetails.HowOut) AS
CountOfOuts, Sum(MatchDetails.Runs) AS Runs, [Runs]/Count([Position])
AS Average
FROM MatchDetails
GROUP BY MatchDetails.PlayerName;

  #2  
Old November 22nd, 2006, 12:43 PM posted to microsoft.public.access.queries
John Spencer
external usenet poster
 
Posts: 7,815
Default Query

What type of field is HowOut? Is it a text field? If so, you should be
able to use one of these expressions.

Abs(Sum(MatchDetails.HowOut "No")) --This will count howout as long
as it is not null or it is not No
or
Count(IIF(MatchDetails.HowOut="No",Null,1)) -- this will count HowOut
if it is null
Or
Count(IIF(MatchDetails.HowOut="No",Null,MatchDetai ls.HowOut)) --This
will count non-null values that are not "No"


"Paid The Umpire" wrote in message
ps.com...
Quick question, I've got the below SQl statement which works well,
except I want the "CountOfOuts" to count all the values in the table
except those which have the value "NO" in it.

Is there a simple way?



SELECT DISTINCTROW MatchDetails.PlayerName,
Count(MatchDetails.Position) AS Innings, Count(MatchDetails.HowOut) AS
CountOfOuts, Sum(MatchDetails.Runs) AS Runs, [Runs]/Count([Position])
AS Average
FROM MatchDetails
GROUP BY MatchDetails.PlayerName;



 




Thread Tools
Display Modes

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 Off
HTML code is Off
Forum Jump


All times are GMT +1. The time now is 02:11 PM.


Powered by vBulletin® Version 3.6.4
Copyright ©2000 - 2024, Jelsoft Enterprises Ltd.
Copyright ©2004-2024 OfficeFrustration.
The comments are property of their posters.