I have my table tbl_noticias
with two dates of type date
: data_criacao_noticia
and data_atualizada_noticia
.
The purpose is for the listing to be sorted as follows:
- If
data_atualizada_noticia
is different from 0000-00-00 and greater thandata_criacao_noticia
should appear first, that is, the most recent date always appears first.
In the following image is the example of what I am trying:
I'm using php and mysql to make the query. Is it possible to use ternary operators in the query or something of the genre?