I want to write a query sql for postgresql that can basically return me all days of a month excluding weekends.
For example (For 11/2019) :
I can't find any postgresql request that can help, this should be automatic instead of putting each time a new date manually.
One method is:
select dt
from generate_series(date'2019-11-01', date'2019-11-30', interval '1' day) as t(dt)
where extract(dow from dt) between 1 and 5
generate_series()
produces a list of all days in the month, then the where
clause filters on week days only.