sulzener
asked on
Simple SQL Select question
I have a table that has a RecStatus field in it. For certain record types, the RecStatus is empty.
When I run the sample queries below, only the records with a RecStatus <> Imported or Pursuing are returned. (ie. RecStatus=Maintaining or New are returned) The records where RecStatus is empty are also not returned. Can someone tell me why? Can someone tell me how to fix? I need the empty RecStatus records as well.
Sample 1:
<cfquery name="sqlAccounts" datasource="#Request.SomeD SN#">
SELECT * FROM tblAccts WHERE RecStatus <> 'Imported' AND RecStatus <> 'Pursuing'
</cfquery>
Sample 2:
<cfquery name="sqlAccounts" datasource="#Request.SomeD SN#">
SELECT * FROM tblAccts WHERE RecStatus NOT IN('Imported','Pursuing')
</cfquery>
When I run the sample queries below, only the records with a RecStatus <> Imported or Pursuing are returned. (ie. RecStatus=Maintaining or New are returned) The records where RecStatus is empty are also not returned. Can someone tell me why? Can someone tell me how to fix? I need the empty RecStatus records as well.
Sample 1:
<cfquery name="sqlAccounts" datasource="#Request.SomeD
SELECT * FROM tblAccts WHERE RecStatus <> 'Imported' AND RecStatus <> 'Pursuing'
</cfquery>
Sample 2:
<cfquery name="sqlAccounts" datasource="#Request.SomeD
SELECT * FROM tblAccts WHERE RecStatus NOT IN('Imported','Pursuing')
</cfquery>
ASKER CERTIFIED SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
ASKER