Barely starting with PostgreSQL I would like to find the correct combination of SELECT to:
select for each Material only the lines in my data that are the most updated.
Material_Number | Last_Chg_Date | Created_Date
-------------------------------------------------
Mat1 | 23-May-16 | 23-May-14
Mat2 | 23-May-16 | 23-May-14
Mat3 | 23-May-16 | 23-May-14
Mat4 | 23-May-16 | 23-May-12
Mat2 | 24-May-16 | 23-May-14
Mat5 | 25-May-16 | 23-May-13
Mat1 | 26-May-16 | 23-May-14
Mat6 | 26-May-16 | 23-May-14
Expected result.
Material_Number | Last_Chg_Date | Created_Date
-------------------------------------------------
Mat3 | 23-May-16 | 23-May-14
Mat4 | 23-May-16 | 23-May-12
Mat2 | 24-May-16 | 23-May-14
Mat5 | 25-May-16 | 23-May-13
Mat1 | 26-May-16 | 23-May-14
Mat6 | 26-May-16 | 23-May-14
the beginning of my code is to select those columns from specific Data:
CREATE TABLE `*output_path*` AS
SELECT
A.Material_Number,
A.Last_Chg as Last_Chg_Date,
A.Created as Created_Date
FROM `*input_path*` A
Can you please help me complete my code.