Mysql - ORDER BY - Can to use condition? -


i sort list date_modified desc

this problem when new record input, date_modified null date 0000-00-00 00:00:00

so record in bottom, not top of list.

how sort ? :(

note: don't insert date_modified date , because have field date_create

order coalesce(date_modified, date_created) desc;

but, performance better if set date_modified current_timestamp when doing insert, suggested.


Comments

Popular posts from this blog

Cursor error with postgresql, pgpool and php -

delphi - ESC/P programming! -

c++ - error: use of deleted function -