mySQL - str_to_date help
$10-15 AUD
Paid on delivery
Hello,
- I have a VARCHAR field that includes date data.
- It is saved either DD-MM-YYYY or DD/MM/YYYY
- I want to run query to compare date > OR <
- Query & data below
SELECT
t1.user_id
IF (t1.exp_date LIKE '%/%', str_to_date (t1.exp_date,'%d/%m/%Y'), str_to_date (t1.exp_date,'%d-%m-%Y')) AS Expiry_Date
FROM certificates as t1
WHERE t1.exp_date > '2020-02-02' <---- this doesn't work
================
Database Set-Up:
CREATE TABLE `certificates` (
`id` int(100) NOT NULL,
`user_id` int(100) NOT NULL,
`certificate_id` int(11) NOT NULL,
`name` varchar(255) NOT NULL,
`doc_num` varchar(255) NOT NULL,
`doc_url` varchar(255) NOT NULL,
`exp_date` varchar(255) NOT NULL,
`approved` int(100) NOT NULL DEFAULT '1' COMMENT '0=pending approval, 1= approved, 2=declined, 3= no document uploaded',
`sendexpire_email` varchar(200) NOT NULL
Project ID: #29446438
About the project
4 freelancers are bidding on average $14 for this job
Hello, this is actually very common problem, if you like just message me and i will show you how to modify the query to get exactly what you need. This will take couple of minutes. Thanks, Milan
hi i am a database developer with 3+ years experience.i can help you to solve this problem. contact me
Hi, this will be fixed just right away. I'd request you to come over chat & share phpMyadmin details & i'll sharing the correct query. Thanks
Hi I am Dennis. I am skilled in PHP programming and I can get the job done for you immediately. Contact me to get started. Thank you.