4
I have my table tbl_noticias with two dates of the type date: data_criacao_noticia and data_atualizada_noticia.
The aim is for the listing to be ordered as follows:
- if the
data_atualizada_noticiais different from 0000-00-00 and greater thandata_criacao_noticiashould appear first, or the latest date always appears first.
In the next image is an example of what I’m trying:

I’m using php and mysql to query. It’s possible to use ternary operators in the query or something like that?
Can sort by code or needs to be in the query?
– Daniel Gregatto
It has to be in the query if possible @Danielgregatto
– pc_oc