Count with a condition

  • Follow


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

0
Reply Utf 12/29/2007 8:48:00 AM

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" <Senthil@discussions.microsoft.com> wrote in message 
news:AD0350B2-9A9C-4EDD-BC81-2D0DD9485CEA@microsoft.com...
>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
> 


0
Reply Douglas 12/29/2007 12:28:59 PM


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" <Senthil@discussions.microsoft.com> wrote in message
news:AD0350B2-9A9C-4EDD-BC81-2D0DD9485CEA@microsoft.com...
> 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
>

0
Reply Jeff 12/29/2007 1:57:14 PM

2 Replies
227 Views

(page loaded in 0.073 seconds)

Similiar Articles:
















7/24/2012 10:49:12 AM


Reply: