これは、CTE(共通テーブル式)を使用して、それを行うための一つの方法です:あなたはウィンドウ関数を使用することができますmodern SQLで
;WITH Maxtable1
AS (SELECT attribute
, name
, MAX(t.date) AS MaxDate
FROM table1
GROUP BY attribute
, name),
Maxtable2
AS (SELECT attribute
, name
, MAX(t.date) AS MaxDate
FROM table2
GROUP BY attribute
, name),
.
.
.
Maxtable<n>
AS (SELECT attribute
, name
, MAX(t.date) AS MaxDate
FROM table<n>
GROUP BY attribute
, name),
DetailTable1
AS (SELECT id
, attribute
, name
, date
FROM table1
INNER JOIN Maxtable1 ON table1.attribute = Maxtable1.attribute
AND table1.name = Maxtable1.name
AND table1.date = Maxtable1.date),
DetailTable2
AS (SELECT id
, attribute
, name
, date
FROM table2
INNER JOIN Maxtable2 ON table2.attribute = Maxtable2.attribute
AND table2.name = Maxtable2.name
AND table2.date = Maxtable2.date),
.
.
.
DetailTable<n>
AS (SELECT id
, attribute
, name
, date
FROM table<n>
INNER JOIN Maxtable<n> ON table<n>.attribute = Maxtable<n>.attribute
AND table<n>.name = Maxtable<n>.name
AND table<n>.date = Maxtable<n>.date)
SELECT *
FROM DetailTable1
UNION
SELECT *
FROM DetailTable2
UNION
.
.
.
SELECT *
FROM DetailTable<n>;
テーブル1とテーブル2の行を と連携。 – monikapatel
私は理解していない、あなたはデータを参照していますか?列が必要な場合は、table1、table2、t – alexrn
で同じと仮定できます。データは@alexrnで編集してください。 – monikapatel