I am trying to select the line (or maybe multiple lines) with the latest date.
Reference to the answer in the thread below. I tried three methods and none is working in the case. Oracle Sql: Select only the latest records by an id and a date
For example, use the most common solution I have something like this.
SELECT ec.dat_cre
FROM sat_hecc ec
WHERE ec.dat_cre=(select max(ec1.dat_cre) from sat_hecc ec1 where ec1.num_int_hcc = ec.num_int_hcc )
However, the result below shows the MAX function isn't working.

Where is the problem? Thank you for your input in advance.
Of course MAX is working; I'd say that it is you, who can't interpret result you got correctly.
Sample table; asterisks mark MAX date per each
num_int_hcc:This is your "original" query:
If you expand it so that it returns
num_int_hccas well, things are much more clear, i.e. query returns rows that correspond to MAXdat_crefor eachnum_int_hcc! That's whatwhereclause in subquery does:If you want to return row that corresponds to MAX
dat_cre, period, then remove thatwhereclause:On the other hand, if you want to avoid scanning the table twice (in subquery (to find MAX value) and main query (to get desired result)), consider switching to a CTE (or a subquery) which utilizes RANK analytic function: