Stephan Szabo <sszabo@xxxxxxxxxxxxxxxxxxxxx> writes: > I think something like: > (CASE WHEN extract(dow from date) = 0 THEN 7 else extract(dow from date)) It's really not that hard: (extract(dow from date) + 6) % 7 You can rotate to any week-start day you like by substituting different things for "6". regards, tom lane ---------------------------(end of broadcast)--------------------------- TIP 2: Don't 'kill -9' the postmaster