I have below 2 tables:
table1
objName | rptName | srcTblName | srcFileName | srcDateColName
--------------------------------------------------------------
obj1 | rpt1 | srcTbl1 | srcFile1.csv| srcDate
table2
FileName | FileSize
------------------------
srcFile1.csv | 2009
The below query gives me distinct Table and Date Column names.
SELECT DISTINCT a.srcTblName, a.SrcDateColName
FROM table1 a
LEFT JOIN table2 b
ON a.srcFileName LIKE b.FileName
WHERE a.srcTblName is NOT NULL
AND a.srcFileName is NOT NULL
Output
srcTblName | srcDateColName
---------------------------------------------
tableN | EntryDate
tableO | Modified_Date
The second column of the output is a COLUMN_NAME in SrcTblName, which is a date.
I want to find the max(srcDateColName) from the respective srcTblName in the same query. Can anyone help me modify the above query?