Jaxel Well-known member Dec 27, 2017 #1 How would I do this query in the new finder system? Code: WHERE event_state = 'visible' AND ( (occur_start >= ? AND occur_start <= ?) OR (occur_end >= ? AND occur_end <= ?) OR (occur_start < ? AND occur_end > ?) )
How would I do this query in the new finder system? Code: WHERE event_state = 'visible' AND ( (occur_start >= ? AND occur_start <= ?) OR (occur_end >= ? AND occur_end <= ?) OR (occur_start < ? AND occur_end > ?) )
Jaxel Well-known member Dec 27, 2017 #2 Figured it out... you can nest additional arrays in a whereOr, and the nested arrays are grouped with an AND, while only the outside arrays have OR. Code: ->whereOr([ ['occur_start', '>=', $start], ['occur_start', '<=', $end], ],[ ['occur_end', '>=', $start], ['occur_end', '<=', $end], ],[ ['occur_start', '<', $start], ['occur_end', '>', $end], ])
Figured it out... you can nest additional arrays in a whereOr, and the nested arrays are grouped with an AND, while only the outside arrays have OR. Code: ->whereOr([ ['occur_start', '>=', $start], ['occur_start', '<=', $end], ],[ ['occur_end', '>=', $start], ['occur_end', '<=', $end], ],[ ['occur_start', '<', $start], ['occur_end', '>', $end], ])