Jenkins
asked on
Get record count
OK. This one is kind of crazy. I currently have a UNION query made up of 5 tables.
I use the query to produce a report of all records within a date range. Each record is one line on my report.
I need to modify it. What I need to do is get a count of the total records in a population.
The population would be all records within the date range I specify. Let's say I specify a date range of 1/1/2008 thru 12/31/2009 and that returns 100,000 records. I need to be able to display that count (100,000) on my report but not print the 100,000 records.
Of the population, I need to print the most current 500 records.
Like I indicated above, I currently have an existing report I use that prints all records within the date range I specify. What I'm trying to do just display the count (in a textbox or whatever) of the total records that are returned within that date range but only print the most current 500 of them (my tables have a Date Field to identify what is most current)
I use the query to produce a report of all records within a date range. Each record is one line on my report.
I need to modify it. What I need to do is get a count of the total records in a population.
The population would be all records within the date range I specify. Let's say I specify a date range of 1/1/2008 thru 12/31/2009 and that returns 100,000 records. I need to be able to display that count (100,000) on my report but not print the 100,000 records.
Of the population, I need to print the most current 500 records.
Like I indicated above, I currently have an existing report I use that prints all records within the date range I specify. What I'm trying to do just display the count (in a textbox or whatever) of the total records that are returned within that date range but only print the most current 500 of them (my tables have a Date Field to identify what is most current)
SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
ASKER
In other words, I need the report to display the detail data from this query:
select top 500 * from Query1 order by Datefield desc
and I need a textbox on the report to display the number from this query:
select count(*) from Query1 where Datefield between date1 and date2
How do I do that?
select top 500 * from Query1 order by Datefield desc
and I need a textbox on the report to display the number from this query:
select count(*) from Query1 where Datefield between date1 and date2
How do I do that?
ASKER CERTIFIED SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
ASKER
Thank you very much
Thanks, glad to help.
ASKER