Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations John Tel on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Count all records before applying record selection formula

Status
Not open for further replies.

mynameant

Programmer
Oct 19, 2005
64
US
Hi all,
I am using CR10 and got a problem. I am selecting bunch of records from a table and applying a record selection formula [let's say Column_1=1]
So, it will return only records with column_1=1.
If i have 100 records and this filter is returning only 20, my requirement is to show total records in report as 100, but total records with filter column_1=1 is 20.

How can I do that? Can I get Total number of records from table before applying this filter?

Thanks a bunch
 
Post what database you're using.

If you only need totals, then create a Union All query in the Add Command as:

select 'All' Source, count(*) from table1
UNION ALL
select 'col1=20' Source, count(*) from table1 where table.column_1 = 1

If you meant to type "my requirement is to show total records in report as 100, but DISPLAY ALL OF THE records with filter column_1=1 is 20", then please take the time to accurately state requirements.

In that case you might just place a subreport with the SQL of select count(*) from table as it's datasource.

Of course this depends upon WHERE you need to show the data, and your database.

Odd how people think that the database type and connectivity have nothing to do with extracting data from a database.

-k
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top