0
我想運行兩個查詢,一個選擇前22行,另一個選擇查詢的其餘行。我可以選擇前22行。但現在我需要選擇接下來的22行。基本上我有2個訪問報告,一個顯示前22行,下一個顯示下22行。任何幫助將不勝感激。有沒有人知道一個功能可以讓我朝着正確的方向發展?如何從ms查詢中選擇最後一組行查詢
這是迄今爲止我的查詢選擇最上面的22行:
SELECT TOP 22[UB-04_line_items].client_id, [UB-04_line_items].revenue_code, Revenue_Codes.rev_code_desc, [UB-04_line_items].total_chgs, [UB-04_line_items].cpt_code, [UB-04_line_items].service_units, [UB-04_line_items].service_date, [UB-04_line_items].total_chgs, Sum(IIf(IsNull([reason_code])=False,[disputed_amount],0)) AS [AMT DISPUTED], GetList("Select Distinct reason_code From [Itemized_statements] As T1 Where t1.reason_code <> NULL AND t1.client_id = " & [Itemized_statements].client_id & " AND T1.revenue_code = " & [Itemized_statements].revenue_code & "","",", ") AS [Err Code]
FROM [UB-04_line_items] INNER JOIN (Itemized_Statements LEFT JOIN Revenue_Codes ON Itemized_Statements.revenue_code = Revenue_Codes.revenue_code) ON [UB-04_line_items].client_id = Itemized_Statements.client_id
GROUP BY [UB-04_line_items].client_id, [UB-04_line_items].revenue_code, Revenue_Codes.rev_code_desc, [UB-04_line_items].cpt_code, [UB-04_line_items].service_units, [UB-04_line_items].service_date, [UB-04_line_items].total_chgs, [UB-04_line_items].total_chgs, Itemized_Statements.client_id, Itemized_Statements.revenue_code
HAVING ((([UB-04_line_items].client_id)=[Itemized_Statements].[client_id]) AND ((Itemized_Statements.client_id)=[forms]![frmClients]![client_ID]) AND ((Itemized_Statements.revenue_code)=[UB-04_line_items].[revenue_code]))
ORDER BY Itemized_Statements.client_id;
有一個類似問題與答案在這裏:http://stackoverflow.com/questions/10455746/select-records-skipping-rows-in-ms-access –
client_id在此查詢或其他字段中是唯一列嗎? – Parfait