'how to get some field of current week data and some of next 7 days data in mysql

Sample dataHi everyone i have tried to write query so i want result as weekly_outstanding column data in current week and recover column get next 7 days data.
3 input paramter team_id, week_start_date, week_end_date output as expected weekly_outstanding column data based on input paramter and recovery data comes from next 7 days for ex- i have select date between 2022-03-28 to 2022-04-03 in input parameter so weekly_outstanding data comes from this week and recovery comes from next week

SELECT sum(weekly_outstanding) as last_week_os, sum(recovery)  FROM `fleet_driver_dash_weekly` WHERE team_id=1 and (week_start_date='2022-03-28' and week_end_date='2022-04-03'


Solution 1:[1]

can you try this, not sure if this solve your problem. can modify if you could share some sample data and expected output.

SELECT sum(weekly_outstanding) as last_week_os
, sum(recovery) over (order by week_start_date asc ROWS BETWEEN CURRENT ROW AND 7 
FOLLOWING)
FROM `fleet_driver_dash_weekly` WHERE team_id=1 ;

Sources

This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.

Source: Stack Overflow

Solution Source
Solution 1 Abishek VK