request adjust price

PHOTO EMBED

Fri Nov 19 2021 03:10:41 GMT+0000 (UTC)

Saved by @emdzungshopee #script

with                base as 
(
select
                    date(from_unixtime(ctime - 3600)) as grass_date,
                    shop_id,
                    status,
                    item_id,
                    data.fields as fields
from                shopee_vn.shopee_item_audit_log_db__item_audit_tab
where               country = 'VN'
                    and from_unixtime(ctime - 3600) >= date'2021-06-01'
), 
                    unnested as 
(
select
                    grass_date,
                    base.shop_id,
                    status,
                    item_id,
                    f.name,
                    f.old,
                    f.new
from                base
left join unnest   (base.fields) as f(name, old, new) on true
)
select              * 
from                unnested
where               name = 'price_before_discount'
content_copyCOPY