mySQL - str_to_date help

Closed Posted 3 years ago Paid on delivery
Closed 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

MySQL Database Programming Database Administration

Project ID: #29446438

About the project

4 proposals Remote project Active 2 years ago

4 freelancers are bidding on average $14 for this job

MimiFL

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

$15 AUD in 1 day
(12 Reviews)
3.2
morteaghorbani

hi i am a database developer with 3+ years experience.i can help you to solve this problem. contact me

$10 AUD in 1 day
(0 Reviews)
0.0
AyubArif

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

$15 AUD in 1 day
(0 Reviews)
0.0
EyepanEkal

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.

$15 AUD in 1 day
(0 Reviews)
0.0