Sql Query To Display Records In Various Scenarios
I have a form which displays data from my table. The form has a field for account id and start date and end date. I want to have multiple scenarios being displayed and have explain
Solution 1:
I assume that if not selected, then its value is an empty string.
SELECT * FROM tbl_call_log_detail
WHERE
(dealer_id = '$call_id' AND '$endDate'='1970-01-01' AND '$startDate' ='1970-01-01')
OR ( time_stamp <= '$endDate' AND time_stamp >= '$startDate'
AND (dealer_id = '$call_id' OR'$call_id'='' ))
OR ('$endDate'='1970-01-01' AND '$startDate' ='1970-01-01' AND '$call_id'='')
ORDER BY id ASC
Post a Comment for "Sql Query To Display Records In Various Scenarios"