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 Chriss Miller on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Query two fields 1

Status
Not open for further replies.

McFestoe

Technical User
Dec 16, 2003
145
GB
I have the following in a query which works

SELECT *
FROM Table1
WHERE (Police)=[enter police];

But i want to add another field, so the query will only list sites that equal the statment, i have tried various ways of getting to work and now i am stuck.

SELECT *
FROM Table1
WHERE (Police)=[enter police]AND SigNO=not Null;

the above returns no records at all, iam trying to get sites listed that Police=area that the user types in and SigNo is not empty.

Thanks
 
Code:
SELECT *
FROM Table1
WHERE (Police)=[enter police] AND SigNO Is Not Null;

John
 
Jrbarnett

I can never remember the difference between = and is, = is for numeric sum and is is for fields and text.

Thanks for solving the 3hours of trying in 5mins a star for your help.
 
The difference is that = is used for testing anything except NULL, where the word "IS" is used instead.

John
 
Hi
Just to explain WHY Null is handled differently:
A Null is a lack of a value and therefore cannot be tested with 'Normal' comparison operators. a Null can NEVER equal any value (it cannot even equal another Null) : To test that create a query that you KNOW will return results, then add on a where clause of Where Null = Null. This will Always return FALSE and therefore No records will be returned.
HTH
Jim
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top