I am not getting the results that I expect from the following code. There are several records where the sub_title field appears to be null but show up in the result set for a query that is testing for the sub_title field not null. Any idea why this is happening?
Code:
<cfquery datasource="FSI-Library" name="keyword">
SELECT sub_title
FROM documentation_list
WHERE doc_pkey BETWEEN 25000 and 30001
</cfquery>
<CFIF #keyword.sub_title# IS "">
<cfquery datasource="FSI-Library" name="no_sub_title">
SELECT (sim_name + ' - ' + title) As doc_title, document_number, sub_title, doc_pkey
FROM documentation_list
WHERE doc_pkey BETWEEN 25000 and 30001
</cfquery>
<cfoutput query="no_sub_title">
#doc_title# - #document_number# - #doc_pkey#<br>
</cfoutput>
<cfelse>
<cfquery datasource="FSI-Library" name="test">
SELECT (sim_name + ' - ' + title + ' - ' + sub_title) As doc_title, document_number, sub_title, doc_pkey
FROM documentation_list
WHERE doc_pkey BETWEEN 25000 and 30001
</cfquery>
<cfoutput query="test">
#doc_title# - #document_number# - #doc_pkey#<br>
</cfoutput>
</cfif>