I does a big mistake i store date in varchar field in database, and when i try to use whereBetween function to get data it gives me annonoumus result due to string nature,
Can anyone tell me how to make this working without affecting database because i no longer have access to the database i can only change this on view
I tried this but this didn’t work ;
SELECT *
FROM `cpds`
WHERE `user_id` = 21
AND STR_TO_DATE(`date`, '%Y-%m-%d') BETWEEN STR_TO_DATE('2025-01-01', '%Y-%m-%d')
AND STR_TO_DATE('2025-12-31', '%Y-%m-%d');