I have a working query which used "BETWEEN" to find results within a date range, what i need is just opposite result or not between the given date range. Here is the query below.
SELECT loanac.id, loanac.name, loanac.lacc, loanac.phone,
SUM(loantrans.in) as totalin, SUM(loantrans.out) as totalout
FROM loanac, loantrans
WHERE (loanac.lacc=loantrans.account)
AND (`loantrans`.`date` BETWEEN CAST('$range' AS DATE) AND CAST('$date' AS DATE))
GROUP BY loanac.lacc
HAVING SUM(IFNULL(`loantrans`.`out`,0)) > SUM(IFNULL(`loantrans`.`in`,0))
Can anyone help me finding opposite result or result of not between the date range having the same conditions?
Details Screenshots here: https://www.dropbox.com/sh/lgmop3zxqaf9mjy/AAAWVWjZXd8da9KDDOqz2ANla?dl=0