Is it possible to replace value field_id_36 with field_id_39 if field_id_36 is empty?
SELECT wt.title, wt.url_title, wt.weblog_id, wt.entry_id, wd.field_id_36
FROM exp_weblog_titles wt
LEFT JOIN exp_weblog_data wd
ON wt.entry_id = wd.entry_id
WHERE wt.weblog_id = {weblog_id_insert}
ORDER BY field_id_36+0
So in theory, this is what I am trying to do:
SELECT wt.title, wt.url_title, wt.weblog_id, wt.entry_id, wd.field_id_36, wd.field_id_39
FROM exp_weblog_titles wt
LEFT JOIN exp_weblog_data wd
ON wt.entry_id = wd.entry_id
WHERE wt.weblog_id = {weblog_id_insert}
ORDER BY if(field_id_36)else(field_id_39)+0