Skip to content
Advertisement

JdbcTemplate SELECT query to get unique rows (each row with unique ID is present once)

Anyone willing to help me out with one jdbctemplate query?

Need to get only rows with unique id’s but there are duplicates, because other columns, such as date have different values. I need to get the max date preferably and the resultset should not have any duplicates. 😡

output:

This almost works, but not quite. There are duplicates sadly.

Here’s the two tables I’m working with.

PS.: Using PostgreSQL

Advertisement

Answer

Figured it out. Here’s the query.

User contributions licensed under: CC BY-SA
4 People found this is helpful
Advertisement