Hello!
There is a table in the database (example):
id| f1 | f_new | f_alt | status 1 | 13 | | | active 2 | 12 | 13 | | archive And there is a request (example)
SELECT * FROM `table` WHERE f1 = '12' or f_alt = '12' The question is: is it possible in the request to find out that the line has a non-empty f_new field and then select the line by value from f_new , i.e. f_new = f1 ( id1 ), and do not select the row id2
UPD. There is a problem if we suppose the table looks like this (you need to get the active drain, i.e. id3 :
id| f1 | f_new | f_alt | status 1 | 13 | 14 | | archive 2 | 12 | 13 | | archive 3 | 14 | | | active