1
I have the following Query in MYSQL:
SELECT id_tabela,titulo,data_gabarito,left(data_gabarito,10) AS d_gabarito FROM tabela
WHERE data_gabarito RLIKE('^[0-9]{2}/[0-9]{2}/[0-9]{4}')
ORDER BY str_to_date(d_gabarito,'%d/%m/%Y') DESC
- It takes a data_feedback field that has strings with various dates and formats and displays only the first ones through the
regex
. (12/02/2019, 11/02/2019, 15/02/2019) takes only the first date. - It converts the alias (d_jig) to date and sorts by higher date.
What I want:
Display only larger records dating two days before today. Example: Today is 07/02/2019, I would like to display only the records with date from two days prior to today’s date (now), ie larger than 05/02/2017.
Explaining more...today is Thursday (07/02/2019) would like to display only records that have larger dates 05/02/2019.
The problem is that you cannot use the ALIAS "AS" in where
to do. d_jig>now-2 for example.
I thought I’d create a view
for this...but perhaps someone sees a simpler solution.
the problem that this data_template is a string that has several formats. There’s a date, there’s text, etc... so I pass it on a regex in the Where to get only the date.
– Rod
worked well put your Where with an AND and kept my regex. Thanks.
– Rod