Hi folks! I have a code chunk that originally goes like this:
var string1 = "SELECT quantity, item, delivery_date FROM deliveries";
rbf_selectQuery(string1, 2000, function(data){
console.log(data)
})
where quantity, item and delivery_date are properties I am interested in getting from deliveries table. However, I will further filter this by a date range via datepickers startDateISO and endDataISO so I tried something like
var string2 = "SELECT quantity FROM deliveries WHERE delivery_date BETWEEN '" + startDateISO + "' AND '" + endDateISO + "'";
rbf_selectQuery(string2, 2000, function(data){
console.log(data)
})
to hopefully increase execution speed (no need to re-filter by date unlike using string1). However, string2 returns an empty data array. A sample startDateISO output is "Sun Apr 27 2014 00:00:00 GMT+0800 (China Standard Time)" while sample endDateISO is "Mon May 26 2014 00:00:00 GMT+0800 (China Standard Time)". A sample delivery_date output is "Wed Apr 30 2014 00:00:00 GMT+0800 (China Standard Time)". They have the same formats but nothing is returned on the "rbf_selectQuery(string2, ...)" line. What am I missing here?
Can you help me figure this out? Any help would be very much appreciated. Thank you!
If you don't add any filter and have the JavaScript code display the delivery_date field, what values do you get that would fit between startDateISO and endDateISO?