我正在尝试加入可通过 QODBC 驱动程序获得的存储过程的结果以及也可通过 QODBC 驱动程序获得的表
基本上我想做(一般而言):
(StoredProcedure [Fields] [parameters]) C
LEFT JOIN (SELECT [Fields] FROM Table) A
ON C.KeyID=A.KeyID
或者
SELECT [Fields]
FROM Table A RIGHT JOIN (StoredProcedure [Fields] [parameters]) C
ON A.KeyID=C.KeyID
我理解应该给我同样的结果。
1 - 存储过程查询
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 - 查询
SELECT Name, AccountType FROM Account
我尝试了以下变体,但没有奏效:
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
或者
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
是否有任何建议可以在不转储到临时表和加入的情况下执行此操作?