oracle?SqlServer?mysql?
DECLARE @RQ1_ DATE,@RQ2_ DATE
set @RQ1_='2022-05-30'
set @RQ2_='2022-06-05'
SELECT (CASE WHEN DATEPART(YEAR,@RQ1_)=DATEPART(YEAR,@RQ2_) AND DATEPART(MONTH,@RQ1_)=DATEPART(MONTH,@RQ2_) THEN 7*1.0/DAY( DATEADD(DAY,-1,DATEADD(MONTH,1,DATEADD(DAY,-(DAY(@RQ1_)-1),@RQ1_))))*26 ELSE ((DATEDIFF (DAY,@RQ1_,DATEADD(DAY,-1,DATEADD(MONTH,1,DATEADD(DAY,-(DAY(@RQ1_)-1),@RQ1_)))))+1)*1.0/DAY( DATEADD(DAY,-1,DATEADD(MONTH,1,DATEADD(DAY,-(DAY(@RQ1_)-1),@RQ1_))))*26 + (7-((DATEDIFF (DAY,@RQ1_,DATEADD(DAY,-1,DATEADD(MONTH,1,DATEADD(DAY,-(DAY(@RQ1_)-1),@RQ1_)))))+1))*1.0/DAY( DATEADD(DAY,-1,DATEADD(MONTH,2,DATEADD(DAY,-(DAY(@RQ1_)-1),@RQ1_))))*25 END)