I have a situation where I've got file names stored in two fields in a table. The fields are called file1 an file2.
file1 is ALWAYS present. file2 might not be present for some rows.
I want to write a query that would get me only a certain extension of files from the DB.
For that I am using for example
...WHERE file1 LIKE '%jpg%'
But here I cannot use AND file2 LIKE '%jpg%'
because file2 may be empty, which is ok.
So what do I do so that the LIKE condition is only applied when the field is not empty?