Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations strongm on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Query Criteria Using And function

Status
Not open for further replies.

geaker

Programmer
Mar 15, 2003
28
US
I have a field named Status in a table. It is defined as "text", 1 character, and default "". Validation rules are must be "" or P or M. Required set to "No', Zero Length set to "Yes". I am trying to pull all records that are not equal to P or M.

I have tried <>&quot;P&quot; And <> &quot;M&quot;, <>&quot;P&quot; or <> &quot;M&quot;. The or retuns records with the Status = P and the &quot;And&quot; returns no record. Anyone have any ideas?

Thanks,
Gerald
 
Try this

select *
from table
where Status not in ('P','M')

Dodge20
 
Dodge,
Thanks for the try but same result as the 'and' function. No records are returned. I have looked at the data in the table and know that &quot;Status&quot; has other than P or M in it. I have also tried the IsNull and IsEmpty.

Thanks
 
I am confused. I gues you could try:

select * from table
where status = &quot;&quot;

Good luck

Dodge20
 
Dodge,
Still no luck. I think I will make the default a 'U', lol. At least that way I can match.

Thanks for the input,
Gerald
 
swampBoogie,
Tried that with the same results.

Thanks,
Gerald
 
I guess I'm confused....Validation rules are must be &quot;&quot; or P or M. I am trying to pull all records that are not equal to P or M.

Wouldn't the remaining records that are not equal to P or M be &quot;&quot; or null??

Why don't one of these statements work?:
Code:
select * from table 
where status = &quot;&quot;
which dodge20 already suggested
or
Code:
select * from table 
where status Is Null
 
I know what y'all are saying. It had me stumped too. I finally changed the default to 'U' for unpaid and it works.

Thanks for the help,
Gerald
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top