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  

Count with a condition



 
 
Thread Tools Display Modes
  #1  
Old December 29th, 2007, 08:48 AM posted to microsoft.public.access.queries
senthil
external usenet poster
 
Posts: 24
Default Count with a condition

I have table called " aug_base " with the following fields
Bill_period,day_1,day_2,day_3,day_4,day_5,day_6 upto day_60

I want to take report bill_period wise count of day_1,day_2,day_3 upto day_60

But in this count should be greater than 100 in each column.

For example :

bill_period day_1 day_2 day_3 day_4
CH1 748 748 748 88
CH1 800 80 80 80
CH1 280 280 85 85

Report should be
bill_period day_1 day_2 day_3 day_4
CH1 3 2 1 1

  #2  
Old December 29th, 2007, 12:28 PM posted to microsoft.public.access.queries
Douglas J. Steele
external usenet poster
 
Posts: 9,313
Default Count with a condition

I'll ignore the fact that your table isn't properly designed: that you
should never have repeating groups like that.

Try:

SELECT bill_period, Sum(IIf([day_1] 100, 1, 0) AS CountOfDay_1,
Sum(IIf([day_2] 100, 1, 0) AS CountOfDay_2, ...
FROM MyTable
GROUP BY bill_period

--
Doug Steele, Microsoft Access MVP
http://I.Am/DougSteele
(no private e-mails, please)


"Senthil" wrote in message
...
I have table called " aug_base " with the following fields
Bill_period,day_1,day_2,day_3,day_4,day_5,day_6 upto day_60

I want to take report bill_period wise count of day_1,day_2,day_3 upto
day_60

But in this count should be greater than 100 in each column.

For example :

bill_period day_1 day_2 day_3 day_4
CH1 748 748 748 88
CH1 800 80 80 80
CH1 280 280 85 85

Report should be
bill_period day_1 day_2 day_3 day_4
CH1 3 2 1 1



  #3  
Old December 29th, 2007, 01:57 PM posted to microsoft.public.access.queries
Jeff Boyce
external usenet poster
 
Posts: 1,555
Default Count with a condition

I won't ignore the table design.

You have a spreadsheet, not a relational database table.

Consider exporting what's in the "table" to Excel and doing the
(spreadsheet) calculation in a spreadsheet.

NOTE: If you want to get the best use of Access' relationally-oriented
features/functions, you can't feed it 'sheet data.

Good luck!

--
Regards

Jeff Boyce
www.InformationFutures.net

Microsoft Office/Access MVP
http://mvp.support.microsoft.com/

Microsoft IT Academy Program Mentor
http://microsoftitacademy.com/

"Senthil" wrote in message
...
I have table called " aug_base " with the following fields
Bill_period,day_1,day_2,day_3,day_4,day_5,day_6 upto day_60

I want to take report bill_period wise count of day_1,day_2,day_3 upto

day_60

But in this count should be greater than 100 in each column.

For example :

bill_period day_1 day_2 day_3 day_4
CH1 748 748 748 88
CH1 800 80 80 80
CH1 280 280 85 85

Report should be
bill_period day_1 day_2 day_3 day_4
CH1 3 2 1 1


 




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 06:34 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.