Postgresql – Replace nested query to get latest related row
I have a query to get all penalty data with latest prices. In prices table there are many prices related to a product. To take the valid price I need to get the latest price. Here is the query. SELECT…