querying sucessive fields in where statement until variable found
i have a table that i want to query first one field and if no results, query next field and so on...
i am doing it now by doing sucessive seperate queries whic works but is probably an inefficient way of doing so... can this be written as a single query??? note that i am using the same variable on each query and only changing the field name i.e. blm_ttl, blm_txt, blm_by
<cfquery name="ckstry" datasource="asker">
SELECT MAX(blmID) AS blmrID
FROM blme
WHERE blm_ttl LIKE ('%#blm_adurl1#%')
</cfquery>
<cfif ckstry.blmrID IS "">
<cfquery name="ckstry" datasource="asker">
SELECT MAX(blmID) AS blmrID
FROM blme
WHERE blm_txt LIKE ('%#blm_adurl1#%')
</cfquery>
</cfif>
<cfif ckstry.blmrID IS "">
<cfquery name="ckstry" datasource="asker">
SELECT MAX(blmID) AS blmrID
FROM blme
WHERE blm_by LIKE ('%#blm_adurl1#%')
</cfquery>
</cfif>
