case when T4.buy_sku_cat2_price_level = T3.cate_2_price_level then 1 else 0 end as user_product_buy_is_match,
T4.buy_sku_cat2_price_level as user_product_buy_price_level
from ${table_name} T1
left join secoo_search.search_data_cross_feature_user_product_buy T2 on T2.p_day = '${yesterday}' and T1.device_id = T2.device_id and T1.product_id = T2.product_id
left join secoo_fact.fact_search_product_wide_p_day T2 on T2.p_day = '${today_param}' and T1.product_id = T2.product_id
left join secoo_fact.fact_search_product_55_30d_click_product_p_day T3 on T3.p_day = ${yesterday} and T2.main_id = T3.product_main_id
left join (
select
uuid,
category_id_2,
max(buy_sku_cat2_price_level) as buy_sku_cat2_price_level