(06-26-2021, 01:51 AM)InsiteFX Wrote: Try this, not tested but fixes some errors in your code see the quotes and semi-colons at the end.
PHP Code:
$sql = 'SELECT
MONTHNAME (itd.DateOfshippment) AS Month
,COUNT(itm.Name) AS Operations
FROM ImportsMaster itm
INNER JOIN ImportsDetails itd on itm.ID = itd.IDMSTR
WHERE itd.Market IS NOT NULL
AND itm.Trader LIKE "%TEXT%"
AND itd.DateOfshippment between :start: and :end:
GROUP BY MONTH(itd.DateOfshippment);';
Thanks but the profiler still returns the

tart: :end: in the query instead of actual values :
Code:
Error Number: 1064
You have an error in your SQL syntax; check the manual that corresponds to your MariaDB server version for the right syntax to use near ':start: and :end: GROUP BY MONTH(itd.DateOfshippment)' at line 8
SELECT MONTHNAME (itd.DateOfshippment) AS Month ,COUNT(itm.Name) AS Operations FROM ImportsMaster itm INNER JOIN ImportsDetails itd on itm.ID = itd.IDMSTR WHERE itd.Market IS NOT NULL AND itm.Trader LIKE "%TEXT%" AND itd.DateOfshippment between :start: and :end: GROUP BY MONTH(itd.DateOfshippment);
I think it should return the actual values from the post data eg 2021-01-01 instead of :start: or not ?
Never mind I found a way to do it with active record actually and some php logic in between . I wanted also same
CASE WHEN conditions and finally it was much easier with active record
Thanks Anyway !!