Skip navigation

Exclusive BETWEEN

score 520
You have not voted. Active

Very often when working with ranges - especially dates - we want the value that is greater than or equal to the range start and less than the range end so that multiple ranges do not overlap, i.e.


range_start <= n < range_end


which is almost but (frustratingly) not quite a BETWEEN expression.


What I'd like would be optional inclusive and exclusive modifiers for the start and end expressions (defaulting to "inclusive" to preserve the current behaviour), allowing something like


where d between startdate and enddate exclusive


or in full,


where d between startdate inclusive and enddate exclusive


(Or of course any equivalent syntax, if for example where d between startdate and enddate exclusive was felt to be ambiguous as the exclusive keyword might look as though it applied to the entire expression.)


Vote history