I use postgresql.
in SQL using two tables: A (date, month, quantity), B (start date, end date)
"select sum (quantity) as total group by month" is the formula
I would like to exclude the quantity between the start and end dates, but
What should I do?
Thank you for your cooperation.
I solved myself.The following SQL works well.
select month, sum (quantity) as total from A where not exists (select * from B where a. date between b. start date and b. end date) group by month
© 2024 OneMinuteCode. All rights reserved.