兩個表,關鍵字是ID,表結構一模一樣只是資料不同。怎樣將兩個表的不一致的資料查詢出?需要將所有欄位不一樣的記錄都查出來;查詢結果匯出excel格式。
謝謝。
uj5u.com熱心網友回復:
1、新建一個查詢,用以下SQL陳述句select 表1.欄位1, 表1.欄位2, 表1.欄位3 from 表1
where not exists (select 1 from 表2 where 表1.欄位1 = 表2.欄位1 and 表1.欄位2 = 表2.欄位2 and 表1.欄位3 = 表2.欄位3)
union all
select 表2.欄位1, 表2.欄位2, 表2.欄位3 from 表2
where not exists (select 1 from 表1 where 表1.欄位1 = 表2.欄位1 and 表1.欄位2 = 表2.欄位2 and 表1.欄位3 = 表2.欄位3)
2、可以利用宏,做一個匯出 Excel 功能,選擇匯出來源為上面的查詢就可以
轉載請註明出處,本文鏈接:https://www.uj5u.com/shujuku/80831.html
標籤:Access
