我有一个表列表:
select tableList
from information_schema.tables
每个表都有一个插入日期。我想得到每个表的最大值(插入日期),并将插入日期放在它旁边,比如:
Column1 Column2
table1 MaxInsertDateTable1
table2 MaxInsertDateTable2
table3 MaxInsertDateTable3
table4 MaxInsertDateTable4
有办法做到这一点吗?我使用的是MPP数据库:
http://www.actian.com/products/big-data-analytics-platforms-with-hadoop/matrix-mpp-analytics-databases/
我设想一个查询,例如:
select 'table1' as column1, max(insertdate) as column2 from table1 union all
select 'table2' as column1, max(insertdate) as column2 from table2 union all
select 'table3' as column1, max(insertdate) as column2 from table3 union all
select 'table4' as column1, max(insertdate) as column2 from table4;