0

我正在尝试加入可通过 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

是否有任何建议可以在不转储到临时表和加入的情况下执行此操作?

4

1 回答 1

2

您可以使用 MS Access 或 Excel 或临时表。将报表和表格的数据导出到 Excel 表,然后执行链接/连接。

参考:http: //qodbc.com/links/2900

是否有任何建议可以在不转储到临时表和加入的情况下执行此操作?

您不能加入存储过程和表,因此您需要在本地或临时表中对输出进行排序。

于 2017-05-01T12:21:32.763 回答