I'm trying to join the results of a stored procedure available through the QODBC driver and a table also available through the QODBC driver
Essentially I would like to do (in general terms):
(StoredProcedure [Fields] [parameters]) C
LEFT JOIN (SELECT [Fields] FROM Table) A
ON C.KeyID=A.KeyID
OR
SELECT [Fields]
FROM Table A RIGHT JOIN (StoredProcedure [Fields] [parameters]) C
ON A.KeyID=C.KeyID
Which I understand should give me the same result.
1 - Stored Procedure Query
sp_report CustomSummary show Label, RowData, LabelAccountName,
Amount, NumColTitleRows, RowType, ReportSubtitle parameters
DateMacro='LastYear', SummarizeRowsBy = 'Account',
SummarizeColumnsBy = 'Month', Calendar = 'FiscalYear',
ReturnRows = 'All', ReturnColumns = 'All', ReportBasis='Accrual',
AccountFilterType='IncomeAndExpense'
2 - Query
SELECT Name, AccountType FROM Account
I tried the below variations, which did not work:
SELECT AccountType, * FROM (sp_report CustomSummary show Label, RowData, LabelAccountName,
Amount, NumColTitleRows, RowType, ReportSubtitle parameters DateMacro='LastYear',
SummarizeRowsBy = 'Account', SummarizeColumnsBy = 'Month', Calendar = 'FiscalYear', ReturnRows = 'All',
ReturnColumns = 'All', ReportBasis='Accrual', AccountFilterType='IncomeAndExpense') C
LEFT JOIN (SELECT Name, AccountType FROM Account) A ON C.LabelAccountName = A.Name
OR
SELECT Name, AccountType FROM Accounts A RIGHT JOIN (sp_report CustomSummary show
Label, RowData, LabelAccountName, Amount, NumColTitleRows, RowType,
ReportSubtitle parameters DateMacro='LastYear', SummarizeRowsBy = 'Account', SummarizeColumnsBy = 'Month',
Calendar = 'FiscalYear', ReturnRows = 'All', ReturnColumns = 'All', ReportBasis='Accrual',
AccountFilterType='IncomeAndExpense') C ON A.Name = C.LabelAccountName
Are there any suggestions for doing this without dumping both to temporary tables and joining?