select
            oi.product_id,
            pi.product_name,
            sum(if(order_date between '2024-04-01' and '2024-06-30',total_amount,0)) as q2_2024_sales_total,
            row_number() over(partition by category order by sum(if(order_date between '2024-04-01' and '2024-06-30',total_amount,0)) desc) as category_rank,
            supplier_name
    from 
            order_info as oi
    left join 
            product_info as pi
    on 
            oi.product_id = pi.product_id
    left join 
            supplier_info as si
    on 
            oi.product_id = si.product_id
    group by 
            oi.product_id
    order by 
            oi.product_id