Connecting to a SQL database. Most of my customers are satisfied with a monthly summary and that was not hard to create but one wants to allow this report to pick a starting date and an ending date and that information can be in any one of those 12 tables that were picked. currently i have this script:
SELECT * FROM REPORTSQL1 where Reportdate between
{?startdate} and {?enddate}
UNION ALL SELECT * FROM REPORTSQL2 where Reportdate
between {?startdate} and {?enddate}
UNION ALL SELECT * FROM REPORTSQL3 where Reportdate
between {?startdate} and {?enddate}
UNION ALL SELECT * FROM REPORTSQL4 where Reportdate
between {?startdate} and {?enddate}
UNION ALL SELECT * FROM REPORTSQL5 where Reportdate
between {?startdate} and {?enddate}
UNION ALL SELECT * FROM REPORTSQL6 where Reportdate
between {?startdate} and {?enddate}
UNION ALL SELECT * FROM REPORTSQL7 where Reportdate
between {?startdate} and {?enddate}
UNION ALL SELECT * FROM REPORTSQL8 where Reportdate
between {?startdate} and {?enddate}
UNION ALL SELECT * FROM REPORTSQL9 where Reportdate
between {?startdate} and {?enddate}
UNION ALL SELECT * FROM REPORTSQL10 where Reportdate
between {?startdate} and {?enddate}
UNION ALL SELECT * FROM REPORTSQL11 where Reportdate
between {?startdate} and {?enddate}
UNION ALL SELECT * FROM REPORTSQL12 where Reportdate
between {?startdate} and {?enddate}
This works but lets say i wanted to do a report for March 28 through April 1 (Monday through Friday) Crystal has to read all twelve months of data to provide 5 days of information. I want a way that it will only pull this data from REPORTSSQL3 and REPORTSSQL4
Again the table structure is identical and state and federal regulations require monthly reports that the sytem istself generates so it is quite easy to provide monthly data, it is spanning months that I would like to do without having to read all twelve tables unless they want a yearly report.
Thanks,
Jeff