Relatively new to Window Functions but I'm pretty sure that's what is needed here. I'm trying to combine two or more rows returned in a dataset that share the same ID/dense_rank into one row.
If there are IDs in the dataset that do not have matches within that table, there will be NULL values.
See what I would like the final results to look like and what I am currently receiving. Not sure if it would be row_number or dense_rank. Thanks! (query below).
select
DENSE_RANK() OVER(ORDER BY l.unit_key) AS ID,
l.unit_key,
l.start_date,
u.area,
c.amount
from unit_rt u
join lease_rt l on u.unit_key = l.unit_key
join charges_rt c on l.lease_key = c.lease_key