Skip to content
Advertisement

How to use multiple whereBetween to sum two different record

I need to compare and sum data from two different date.

Assuming i have 4 input dates

JavaScript

Currently, my query only able to get one whereBetween date data as below

Current Code

JavaScript

Current result from startdate and enddate

JavaScript

Example another result from compare_startdate and compare_enddate

JavaScript

How to query another result from compare_startdate to compare_enddate in order to sum result of startdate and enddate?

Expected result

JavaScript

I did try something like this in query but result is incorrect

JavaScript

Advertisement

Answer

Hi Friend You Can Use orWhereBetween in advance where clause as below,

JavaScript
User contributions licensed under: CC BY-SA
8 People found this is helpful
Advertisement