2 Answers
- Newest
- Most votes
- Most comments
3
Hello,
Update might not be suitable for changing/updating multiple rows in a transaction as Athena Iceberg UPDATE writes Iceberg position delete files and newly updated rows as data files in the same transaction. So, you can try using merge into
statement for this approach. Details are given here.
MERGE INTO skus_market_share_sum1 m
USING other_table o
ON o.SKU = m.SKU
WHEN MATCHED THEN
UPDATE SET m.sales_kpis_sales_7d_agg = o.new_values;
This will perform an update where rows match between the two tables based on the ON condition.
2
Could run Merge into with Select, example below
MERGE INTO skus_market_share_sum1 t
USING (
select *
from (
<>
)
where rn = 1 AND category LIKE '%NNN%'
) s
ON (t.sku = s.sku)
WHEN MATCHED
THEN UPDATE
SET sales_kpis_sales_7d_agg = s.sales_kpis_sales_7d_agg
answered 9 months ago
Relevant content
- asked 2 years ago
- Accepted Answerasked 2 years ago
- asked a year ago
- AWS OFFICIALUpdated 2 months ago
- AWS OFFICIALUpdated 2 months ago
- AWS OFFICIALUpdated 8 months ago
- AWS OFFICIALUpdated 7 months ago
Thank you. Is there an option to use Merge into with specific select? like: select * from ( select *, row_number() over (.....) rn from <table>
) where rn = 1
Thank you