Error: incomplete SQL: SELECT A.ID_H,
SUM(A.COST) COST
FROM (SELECT ID_H,
ID_J,
COST,
RANK() OVER(PARTITION BY ID_J ORDER BY ID_H ASC) RNK
FROM MYTABLE
) A WHERE A.RNK = 1
GROUP BY A.ID_H
near "(": syntax error: SELECT A.ID_H,
SUM(A.COST) COST