Thanks for that - you're right, if I change query to
sp_report TxnDetailByAccount show TxnType, Date, RefNumber, AccountFullName, AccountName, Account, Amount parameters AccountFilterType = 'OrdinaryIncome', DateMacro = 'ThisYearToDate' where rowtype = 'DataRow'
then it runs quickly.
So, now, if I split it into seperate queries for each year, how do I combine the data from the seperate queries into a single set of records from which to build a report?
eg -
sp_report TxnDetailByAccount show TxnType, Date, RefNumber, AccountFullName, AccountName, Account, Amount parameters AccountFilterType = 'OrdinaryIncome', DateMacro = 'ThisYearToDate' where rowtype = 'DataRow'
sp_report TxnDetailByAccount show TxnType, Date, RefNumber, AccountFullName, AccountName, Account, Amount parameters AccountFilterType = 'OrdinaryIncome', DateMacro = 'LastYear' where rowtype = 'DataRow'
How do I combine the data from these 2 commands, to create a single set of data including all of last year and the current year? I thought a UNION might do it, like this, but that's obviously not correct:
sp_report TxnDetailByAccount show TxnType, Date, RefNumber, AccountFullName, AccountName, Account, Amount parameters AccountFilterType = 'OrdinaryIncome', DateMacro = 'ThisYearToDate' where rowtype = 'DataRow' UNION sp_report TxnDetailByAccount show TxnType, Date, RefNumber, AccountFullName, AccountName, Account, Amount parameters AccountFilterType = 'OrdinaryIncome', DateMacro = 'LastYear' where rowtype = 'DataRow'
Any help would be appreciated
Thanks! |